|
-
Aug 5th, 2004, 09:13 AM
#1
Thread Starter
New Member
Threading Forms
Hi all,
I am trying to make a project that takes data from an Access database and moves the data to another database. What it does right now, is responds to a click and the data migration goes through fine.
During the execution I have a DataReader of the information received from the database. What I would like to happen would be to have a form pop up right after the datareader is returned, so I could map the columns from the DataReader to specific fields in the destination database.
What happens right now is, the form for the data mapping pops up, but the actions in the background continue to go through. How can I get the actions in the back to stop while I wait for the user to map fields?
Thanks
Josh
-
Aug 5th, 2004, 10:02 AM
#2
Addicted Member
why not just simply raise an event once the datareader has returned to signal your worker thread to suspend. Once your data mapper dialog has been closed simply resume.
-
Aug 5th, 2004, 10:11 AM
#3
Thread Starter
New Member
My problem is that the "worker thread" is really just a form. Will I have to recode this into a thread for that to work?
Thanks
Josh
-
Aug 5th, 2004, 10:29 AM
#4
Addicted Member
Originally posted by kandiko
My problem is that the "worker thread" is really just a form. Will I have to recode this into a thread for that to work?
You are opening the data mapping dialog modally, right?
-
Aug 5th, 2004, 10:33 AM
#5
Thread Starter
New Member
What I have is frmMain. It is the startup form. From there, a user can access the menu and select the type of transfer. After the user selects the transfer, frmMain starts the data transfer process.
From there, it creates a thread that shows a frmDataMappings. Unfortunetly, frmDataMappings shows, but the following statements in frmMain continue.
How should I code frmMain into a thread that can be stopped and started? Do I need another form to make the calls and set which thread can currently go?
Thanks
Josh
-
Aug 5th, 2004, 10:43 AM
#6
Addicted Member
Got you now...
I wouldn't open frmDataMappings from a thread created by frmMain. I would :
user selects option from frmMain
a worker thread is spawned to do the source db read
the (now full) datareader is returned
an event fires to signal frmDataMappings to show (modally)
user does the mapping
user closes frmDataMappings - form close event fires a 'resume' event to worker thread
execution continues
..that way you can safely control the outcome if your source read should fail i.e pop up a list of alternative actions, retry dialogs etc.
HTH
-
Aug 5th, 2004, 03:26 PM
#7
Thread Starter
New Member
Thanks for the help. I am having some problems executing this. In frmMain I tell my workerThread to spinup and then get the data. Afterwhich, I raise an event from the thread. A module handles the event and calls the code to open the form. After that call, I pause the thread. But once that thread is paused, it also pauses the form, and thus nothing happens. Where can I raise the event and make the call so as not to stop the form?
Thanks
Josh
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|