R
Roger
I have a function that is currently wrapped up in a Class so I can pass a
variable to it.
This function is going to be threaded out and I would like the class
function to be able to update a control on my form. (Treeview).
Is this possible and how do I do it?
Here is a simplisitc overview of what I am doing...
Public Class Form1
Public Sub Button1_Click
GetDirs()
end sub
Public Sub GetDirs()
Dim dir As String
Dim i As Integer = 1
Dim dirs() As String = Directory.GetDirectories("P:\")
For Each dir In dirs
Dim t As System.Threading.Thread
dim oListView as new SubClass1
t = New System.Threading.Thread(AddressOf
oListView.FileListToListView)
oListView.sFolder = dir
'''' I thought by passing the Treeview1 control I could update
it in the class...
oListView.tView = TreeView1
t.Start()
i += 1
ProgressBar1.Value = 100 * (i / CLng(UBound(dirs)))
Next
End Sub
end class
Public Class SubClass1
Public sFolder as string
public tView as treeview
public sub FileListToListView
'''' **** Here is where I want to update the Form1.treeview1 control
tview.nodes.add(sFolder)
end sub
end class
variable to it.
This function is going to be threaded out and I would like the class
function to be able to update a control on my form. (Treeview).
Is this possible and how do I do it?
Here is a simplisitc overview of what I am doing...
Public Class Form1
Public Sub Button1_Click
GetDirs()
end sub
Public Sub GetDirs()
Dim dir As String
Dim i As Integer = 1
Dim dirs() As String = Directory.GetDirectories("P:\")
For Each dir In dirs
Dim t As System.Threading.Thread
dim oListView as new SubClass1
t = New System.Threading.Thread(AddressOf
oListView.FileListToListView)
oListView.sFolder = dir
'''' I thought by passing the Treeview1 control I could update
it in the class...
oListView.tView = TreeView1
t.Start()
i += 1
ProgressBar1.Value = 100 * (i / CLng(UBound(dirs)))
Next
End Sub
end class
Public Class SubClass1
Public sFolder as string
public tView as treeview
public sub FileListToListView
'''' **** Here is where I want to update the Form1.treeview1 control
tview.nodes.add(sFolder)
end sub
end class