Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[Newb TuT] How to use muiltithreading {My first tut}[Newb TuT] [Very useful]

Muitithreading


Before I start I'm going to assume you know the basics, such as Imports, classes, Subs, Variables and the syntax of vb. If you don't go here HERE and start going threw the tutorials.

Ok so now on to muiltithreading, you can thank of muiltithreading as multitasking in VB.NET. You can start a sub but still have the other on going. Its A good thing to learn if you want to make a bot, viewer, spammer are anything really.

Step one - Add the controls

Controls (Click to View)

Step two - Add 2 subs

Ok so now I'm going to add two subs, One is going to make my first label count up the other will make the other label count up. To do this your going to make a while loop that make a label go to 10 in each one then pause for 1000 millisec's like so..
Image (Click to View)

Step three - button one (No muiltithreading)

Ok so now you have the 2 subs to count the labels up, now we have to set the 2 buttons, one will muitithread one wont. First go to the one that wont and make it call both of the subs you just made like so..
Image (Click to View)

Step 4 - button two (muiltithreading)

Last but not least we have to and the muitithreading button. This is fairly easy. First import system.threading. next declare 2 threads. After that you set the threads to the address of the sub as show below. You will find when you click the button without muiltithreading it will basically freeze but if you press the other button the labels will count up.
Image (Click to View)

PROFIT!!

Awesome Tut ! Thanks for that .
(Jul 7, 2011 05:49 PM)xXxRay Wrote:  Awesome Tut ! Thanks for that .

Thanks I spend A good hour on it I just added the photos
Dim T As New System.Threading.Thread(AddressOf SubShit)
T.Start()
Why would you create an infinite loop that you must force-close? Bad way to teach beginners..
[Image: Xtddh8V.png]
(Jul 7, 2011 05:55 PM)Deceptive Wrote:  Dim T As New System.Threading.Thread(AddressOf SubShit)
T.Start()

That works two, Ill add that in a sec

(Jul 7, 2011 05:55 PM)Fake. Wrote:  Why would you create an infinite loop that you must force-close? Bad way to teach beginners..

Changing now, just give me a sec
EXTREMELY bad coding habits.

Even if VB does it automatically for you, always convert strings to integers when doing integer work. Going on to other languages like this will result in epic failure.
Me.CheckForIllegalCroosThreadsCalls = False

(Jul 7, 2011 11:40 PM)TickTack Wrote:  EXTREMELY bad coding habits.

Super EXTREMELY bad coding habits.

Updating GUI from another thread in unsafe way... Use Control.Invoke if you want to update GUI from another thread.
https://hackforums.net/showthread.php?tid=1410154

This looks like a pretty decent tutorial, well done.
Thanks for the tut man, am learning multithreading for a booter im making =/

[Image: eQhTFwh.gif]



Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by KushOct 8, 2012 04:09 PM 6 150 Oct 8, 2012 04:09 PM
Last Post: Kush
[C] by JsTFKNGooGLEiTJan 29, 2010 07:35 PM 4 59 Jan 29, 2010 07:35 PM
Last Post: JsTFKNGooGLEiT