【求助】Invoke问题-模块中代码调用Form中代码的问题
如下的代码存在form中:
------------------------
Public Class Form1 '添加到Listview Function AddToListView(ByVal id As Integer, ByVal type As String, ByVal value As String, ByVal path As String) As Boolean Dim s As New ListViewItem s.Text = id.ToString s.SubItems.Add(type) s.SubItems.Add(value) s.SubItems.Add(path) ListView1.Items.Add(s) AddToListView = True End Function Private Delegate Function vL(ByVal id As Integer, ByVal type As String, ByVal value As String, ByVal path As String) As Boolean Sub goodme(ByVal id As Integer, ByVal type As String, ByVal value As String, ByVal path As String) Do While Me.IsHandleCreated = False Application.DoEvents() Debug.Print("trad") Loop Me.Invoke(New vL(AddressOf AddToListView), id, type, value, path) End Sub Private Sub bFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bFind.Click Dim i As New Threading.Thread(AddressOf good) i.Start() End Sub Sub good() Call goodme(1, "dir", "1.txt", "C:\1.txt") Debug.Print("ok") End SubEnd Class