Click here to Skip to main content
16,006,006 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralTest a connection to SQL Server Pin
marclenoir200515-Dec-04 10:18
marclenoir200515-Dec-04 10:18 
GeneralRe: Test a connection to SQL Server Pin
jonathan1517-Dec-04 2:56
jonathan1517-Dec-04 2:56 
GeneralInternal Domain Email Issues Pin
CitizenSoldier15-Dec-04 9:35
CitizenSoldier15-Dec-04 9:35 
GeneralFiles Closed but Not Really -- Database Error 16040 Pin
aubndez15-Dec-04 5:23
aubndez15-Dec-04 5:23 
GeneralForm creation crisis!!! Pin
carlos_rocha15-Dec-04 4:33
carlos_rocha15-Dec-04 4:33 
GeneralRe: Form creation crisis!!! Pin
Dennis C. Dietrich15-Dec-04 4:49
Dennis C. Dietrich15-Dec-04 4:49 
GeneralRe: Form creation crisis!!! Pin
carlos_rocha15-Dec-04 5:18
carlos_rocha15-Dec-04 5:18 
GeneralRe: Form creation crisis!!! Pin
Dennis C. Dietrich15-Dec-04 5:51
Dennis C. Dietrich15-Dec-04 5:51 
carlos_rocha wrote:
I haev the main form, FORM1 that has an object that contains a thread.When something happens in that thread i raise and event to FORM1 and the handler calls a function that creates the form.

Well, if I understood you correctly you've got an event handler like this which is called in another thread (i.e. other than the thread that owns form1 and most likely runs the standard
application message loop):
Private Sub SomeEventHandler()
  someObjVar = New Form2()
  someObjVar.Show()
End Sub

The problem is that you're not supposed to do this in any thread. In general only the thread that owns a control (meaning that originally created it) should manipulate it. The easiest way is to create any controls (that includes forms and usercontrols) in the same thread. Therefore you need to make a cross-thread call if you want to do something with your UI from another thread. To find out if the call needs to be marshalled you use the Control.InvokeRequired Property[^] and end up with something like this:
Private Sub SomeEventHandler()
  If Me.InvokeRequired Then
    Me.Invoke(New appropriateDelegate(AddressOf Me.SomeEventHandler))
  Else
    someObjVar = New Form2()
    someObjVar.Show()
  End If
End Sub

I recommend you keep on reading the MSDN articles and references and come back and ask again whenever you don't understand something. Threading is a straining business and if you don't know what your doing you might end up with some strange behaviour (for example if you don't have a good concept for handling exceptions or call some control's methods Wink | ;-) ).

Best regards
Dennis
GeneralRe: Form creation crisis!!! Pin
carlos_rocha15-Dec-04 6:14
carlos_rocha15-Dec-04 6:14 
GeneralRe: Form creation crisis!!! Pin
Dennis C. Dietrich15-Dec-04 6:35
Dennis C. Dietrich15-Dec-04 6:35 
GeneralRe: Form creation crisis!!! Pin
carlos_rocha15-Dec-04 6:43
carlos_rocha15-Dec-04 6:43 
GeneralRe: Form creation crisis!!! Pin
carlos_rocha15-Dec-04 22:11
carlos_rocha15-Dec-04 22:11 
QuestionHow to add Icon Overlay in VB.Net Pin
Zenly15-Dec-04 3:56
Zenly15-Dec-04 3:56 
AnswerRe: How to add Icon Overlay in VB.Net Pin
Zenly16-Dec-04 6:14
Zenly16-Dec-04 6:14 
Generalfont like property Pin
Stumped115-Dec-04 3:21
sussStumped115-Dec-04 3:21 
GeneralRe: font like property Pin
OICU81215-Dec-04 16:52
OICU81215-Dec-04 16:52 
GeneralRe: font like property Pin
Stumped116-Dec-04 2:43
sussStumped116-Dec-04 2:43 
GeneralRe: font like property Pin
OICU81216-Dec-04 4:50
OICU81216-Dec-04 4:50 
GeneralHelp needed Pin
singhrajendra15-Dec-04 2:00
singhrajendra15-Dec-04 2:00 
GeneralRe: Help needed Pin
Dennis C. Dietrich15-Dec-04 2:16
Dennis C. Dietrich15-Dec-04 2:16 
GeneralRe: Help needed Pin
singhrajendra15-Dec-04 18:45
singhrajendra15-Dec-04 18:45 
GeneralRe: Help needed Pin
Dave Kreskowiak16-Dec-04 3:42
mveDave Kreskowiak16-Dec-04 3:42 
GeneralMod Operator Help PLEASE... Pin
stingerj15-Dec-04 1:18
stingerj15-Dec-04 1:18 
GeneralRe: Mod Operator Help PLEASE... Pin
Dennis C. Dietrich15-Dec-04 1:46
Dennis C. Dietrich15-Dec-04 1:46 
GeneralRe: Mod Operator Help PLEASE... Pin
stingerj15-Dec-04 2:46
stingerj15-Dec-04 2:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.