Multi Thread 07-30-2013, 06:33 PM
#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
Step 2:
Declare a new thread to handle a sub/function, I will be using a simple tick/counter
Sub Main Load:
Counter Class:
And thats it! If you have a line which uses a + or * or / symbol than use this:
Or else a you will get a threading error.
Enjoy
Step 1 :
Make a new Console Application and Import threading into the project
PHP Code:
Imports System.Threading
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()
PHP Code:
Sub Example()
For i = 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() i = i + 0, MethodInvoker))
Enjoy
![Biggrin Biggrin](https://sinister.ly/images/smilies/set/biggrin.png)
![[Image: YpEtJDQ.png]](http://i.imgur.com/YpEtJDQ.png)