I have created a Windows application. I want to launch a form using thread. But this is not working well.
Following is my code:
Expand|Select|Wrap|Line Numbers
- Private Sub cmdShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShow.Click
- Dim thForm As Threading.Thread
- Dim i As Int32
- For i = 0 To 20
- thForm = New Threading.Thread(AddressOf ShowForm)
- thForm.Start()
- Next
- End Sub
- Private Sub ShowForm()
- Dim F2 As Form2
- F2 = New Form2
- F2.Show()
- End Sub
The problem is that, 'Form2' become disappear after launching.
But when i use F2.ShowDialog(), it will working well.
I can't be able to understand the problem. Can anyone help me?
Regards,
Ashish