473,398 Members | 2,125 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,398 software developers and data experts.

Multithread Problem

hi

i am trying to make simple application to learn multi thread

but i have problem to make it

the problem is the form can't respond while loading data

i want to make it loading,but i can open new form

thx

this my sample


Expand|Select|Wrap|Line Numbers
  1. Imports System.ComponentModel
  2. Imports System.Threading
  3.  
  4. Public Class Form1
  5.     Dim othread(10) As Thread
  6.     Private Sub Startprocess(ByVal state As Object)
  7.         If Me.InvokeRequired Then
  8.             Me.Invoke(New MethodInvoker(AddressOf Fill))
  9.         Else
  10.             Fill()
  11.         End If
  12.     End Sub
  13.     Private Sub Fill()
  14.         For counter As Integer = 0 To 2000
  15.             If counter = 2000 Then Label1.Text = "THE FORM IS FINISH"
  16.             Debug.WriteLine(counter)
  17.         Next
  18.     End Sub
  19.  
  20.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  21.         System.Threading.ThreadPool.QueueUserWorkItem(New System.Threading.WaitCallback(AddressOf Startprocess))
  22.         Label1.Text = "THE FORM IS LOADING"
  23.     End Sub
  24.  
  25.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  26.         Form2.Show()
  27.     End Sub
  28.  
  29. End Class
Feb 7 '08 #1
3 1095
kadghar
1,295 Expert 1GB
hi
i am trying to make simple application to learn multi thread
but i have problem to make it
the problem is the form can't respond while loading data
i want to make it loading,but i can open new form
thx
Have you tried using DoEvents?
It might not help, since you use only one line to load the data. But give it a try, the chances are good. ^.^
Feb 7 '08 #2
Killer42
8,435 Expert 8TB
Subscribing .
Feb 8 '08 #3
if i use do event i scared that it will make application slow,
cause i call this do event every loop data

i read some artikel ,
it like use something like x process communication
but i don't know how to use it
Feb 8 '08 #4

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

Similar topics

12
by: haptiK | last post by:
Hello, can i use php to multithread mail() or something similar? in my company i need to send multiple copies of email to a few hundred ppl affilated and on my list. instead of calling mail...
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...
2
by: tikcireviva | last post by:
Hi Guys, I've done a mulithread queue implementation on stl<queue>, my developement environment is on VC6 as well as FC3. Let's talks about the win32 side. The suspected memory leak is find...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.