|
-
Jan 15th, 2005, 03:50 PM
#1
Threading Basics
Hi
This code is supposed to be a threading example that writes to a console but I can make it work, can you take a lok to see what I'm doing wrong? It doesn't error, it just doesn't do anything. The code is based on an example from Francesco Balena's book.
thanks
VB Code:
Imports System.IO
Imports System.Threading
Sub DoTheTask()
For i As Integer = 1 To 10
Console.WriteLine("Msg #{0} from the second thread", i)
Thread.Sleep(200)
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim t As New Thread(New ThreadStart(AddressOf DoTheTask))
t.Start()
For i As Integer = 1 To 10
Console.WriteLine("Msg #{0} from the main thread", i)
Thread.Sleep(200)
Next
End Sub
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Jan 15th, 2005, 06:25 PM
#2
Hyperactive Member
Re: Threading Basics
Code works fine for me....
Look at your Output Tab for the results, works fine..
-
Jan 15th, 2005, 07:40 PM
#3
Re: Threading Basics
thanks,
so the Console is not the command line console, it's the output Window?
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|