![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, VB.Net 2005 Windows XP Pro Is this legal? It works...something doesn't seem quite right...??? Problem outlined below (at end) 'This is the main application form...main thread public sub new() InitializeComponent() 'This is another form I want to run on its own msg pump dim myForm as new frmSomeForm() 'Initialize Component is called here myForm.myProperty = 10 'No big deal Dim t As New Thread(New ParameterizedThreadStart(AddressOf startUIThread)) t.SetApartmentState(ApartmentState.STA) t.Start(myForm) end sub STAThread()> _ Private Sub startUIThread(ByVal theForm As Object) Try Application.Run(CType(theForm, Form)) Catch ex As Exception log.Error(ex.ToString, ex.InnerException) End Try End Sub My problem (in frmSomeForm): My log file indicates InvokeRequired is FALSE, but when I access the combo box on this form, I'm getting a CROSS THREADED EXCEPTION...? Private Sub mvarDataSupplier_initialized() Handles mvarDataSupplier.initialized Try If (InvokeRequired) Then log.Debug("InvokeRequired") Dim d As New mvarDataSupplier_initializedDelegate(AddressOf mvarDataSupplier_initialized) Invoke(d, Nothing) Exit Sub End If With Me.cboGroups .Items.Clear() 'cross threaded exception here End With End Sub -- thanks in advance, georgejetson |
#3
| |||
| |||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |