I am try to add controls to my program , which i have no problem
doing. The problem is i want to improve the speed/preformance of my
App, i have delcare and get a number of thread to complete work. one
of which is to add x number of controls to the form.
this is the sub called by the thread
Private Sub mythreadmethod1()
CentralSQL.SQLString = "Exec spTC_ResourceGroups '" &
strProjNo & "'"
Dim xPos As Integer = 1
For Each Group As String In CentralSQL.Read(1, SQLConn)
If Group = "" Then Group = "UnAssigned"
Ctrl1 = New CustomControl
Ctrl1.Header.Text = Group
If xPos > 1 Then
Ctrl1.Location = New Point((Ctrl1.Width * (xPos - 1))
+ 3, 1) '# position next ctrl to the perviously control
Else
Ctrl1.Location = New Point(1, 1)
End If
If Me.InvokeRequired Then
' It's on a different thread, so use Invoke.
Me.Invoke(Me.Controls.Add(Ctrl1)) <-----------------
not sure what to here
Else
Me.Ribbon1.Controls.Add(Ctrl1)
End If
xPos += 1
Next
End Sub