473,385 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

MultiThread: how can I do two or more procedures

MultiThread: how can I do two or more procedures?

Expand|Select|Wrap|Line Numbers
  1. Dim I1 As Integer
  2.     Dim I2 As Integer
  3.  
  4.     Dim THREAD1 As System.Threading.Thread
  5.     Dim THREAD2 As System.Threading.Thread
  6.  
  7.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  8.         Control.CheckForIllegalCrossThreadCalls = False
  9.     End Sub
  10.  
  11.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  12.         THREAD1 = New System.Threading.Thread(AddressOf COUNTUP1)
  13.         THREAD1.Start()
  14.     End Sub
  15.  
  16.     Private Sub COUNTUP1()
  17.         Do Until I1 = 1000
  18.             I1 = I1 + 1
  19.             Label1.Text = I1
  20.             Me.Refresh()
  21.         Loop
  22.  
  23.         I1 = 0
  24.     End Sub
  25.  
  26.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  27.         THREAD2 = New System.Threading.Thread(AddressOf COUNTUP2)
  28.         THREAD2.Start()
  29.     End Sub
  30.  
  31.     Private Sub COUNTUP2()
  32.         Do Until I2 = 1000
  33.             I2 = I2 + 1
  34.             Label2.Text = I2
  35.             Me.Refresh()
  36.         Loop
  37.  
  38.         I2 = 0
  39.     End Sub
  40.  
  41.     Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  42.         THREAD1.Abort()
  43.         THREAD2.Abort()
  44.     End Sub
Feb 7 '14 #1
1 987
Frinavale
9,735 Expert Mod 8TB
Create more than one thread?
I'm not clear on what your question is.
Feb 12 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: dbmethods | last post by:
Could someone give a hint on how to do multithread programming with PHP scripting here? Thanks
3
by: tekanet | last post by:
Hello folks, I usually use this way to store more procedures inside a single SP: CREATE PROCEDURE usp_MyProc (@usp_mode int) AS IF @usp_mode = 1 BEGIN END
0
by: Alice | last post by:
Hello I have four multithread windows applications(vb.net) interacting and running on the same machine(windows 2000 with .net framework 1.0). All of them start a new thread each time Filewatcher's...
0
by: r_obert | last post by:
Hello, I'm trying to create a worker thread for my VC++ program, and was wondering whether I should be linking with the Multithread /MT or Multithread DLL /MD option? I'm not quite sure, in...
4
by: zbcong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting for a...
2
by: zhebincong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting...
0
by: fred | last post by:
I need some help in trying to understand how to make myCollection (inherited from CollectionBase) multithread safe. Taking my implementation of the Add Sub and a readonly property Item. Public...
6
by: jmartin | last post by:
Hi, I have made a multithread version of a program (load a file into database), and with two processors I get the double of time in the multithread than in the process (unithread) version. I...
0
by: Gordon Cone | last post by:
I am currently debugging a deadlock in a multithread C# application. It makes lots of calls to legacy unmanaged code. The application runs on windows sever 2003 and uses the sever version of the...
0
by: Gordon Cone | last post by:
I am currently debugging a deadlock in a multithread C# application. It makes lots of calls to legacy unmanaged code. The application runs on windows sever 2003 and uses the sever version of the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.