Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


Multi Thread filter_list
Author
Message
Multi Thread #1
Greetings CM members, Today I'm gonna show you how to easily multi-thread your applications to prevent annoying crashing.

Step 1 :
Make a new Console Application and Import threading into the project
PHP Code:
Imports System.Threading 
Step 2:
Declare a new thread to handle a sub/function, I will be using a simple tick/counter
Sub Main Load:
PHP Code:
Dim T1 As New Thread(Sub() Example())
T1.Start() 
Counter Class:
PHP Code:
Sub Example()
        For 
0 To 10
            Threading
.Thread.Sleep(1000)
            
Console.WriteLine(i)
        
Next
    End Sub 

And thats it! If you have a line which uses a + or * or / symbol than use this:
PHP Code:
Me.Invoke(DirectCast(Sub() 0MethodInvoker)) 
Or else a you will get a threading error.

Enjoy Biggrin
[Image: YpEtJDQ.png]

Reply







Users browsing this thread: 1 Guest(s)