Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

multiple threads with a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Li Weng - 18 Jul 2006 16:02 GMT
Hi,

I have a form in main thread. I also use a 2nd thread as datalayer for
dataset <--> SQL Server. I have some controls that binds with the dataset.

When the 2nd thread modifies the dataset, it will trigger events of a
control that binds to the dataset. My question is if the event run on the 2nd
thread or the main thread?

When I step in, I check Me.InvokeRequired and it's True. Does that mean the
event run on the 2nd (background) thread?

Thanks in advance.

Li
Kevin Spencer - 18 Jul 2006 16:22 GMT
The event runs on the 2nd thread. A Windows form is a Single-Threaded
Apartment. If you're working with .Net platform 2.0, you might want to check
out the BackgroundWorker component:

http://msdn2.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx

Otherwise, here are a few articles that will help even if a BackgroundWorker
is not available:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/wi
nforms06112002.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/wi
nforms08162002.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/wi
nforms08162002.asp


Signature

HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

What You Seek Is What You Get.

> Hi,
>
[quoted text clipped - 13 lines]
>
> Li
Li Weng - 18 Jul 2006 19:45 GMT
Thanks a lot! Kevin.

Li

> The event runs on the 2nd thread. A Windows form is a Single-Threaded
> Apartment. If you're working with .Net platform 2.0, you might want to check
[quoted text clipped - 26 lines]
> >
> > Li

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.