Thread Part 3

  • Thread starter Charles A. Lackman
  • Start date
C

Charles A. Lackman

Hello and Thanks again,

Maybe I am not explaining what I am looking for good enough and maybe I
should not be using muli-threads at all. What I am after is the following:

Form1 instantiates Form2 using SHOW, which is always on top. Form2 is a
clipboard, where the user can copy and paste information into it and into
Form3 which will filled with Textboxes.

In Form2 (The clipboard) there is a button that says "Send Data To Form3".

Background Info:

Form1 has a button that say's "Add New Data". When the "Add New Data"
button is clicked, From3 is displayed using SHOWDIALOG. Here the user can
add new data to a database.

When Form2's button is clicked ("Send Data To Form3"), I need Form3 to be
displayed using SHOWDIALOG so that only one instance of the form is being
used at a time. I still need Form2 (The clipboard) to be on top and still
usable (Able to be moved and accessed)

Thanks,

Chuck
 
R

Robby

Instead of threading could you just show as a normal top most form? When
the selection is made on frm1PollDatabase raise an event on the main form.
You could then create frm1Modify on the main form, fill it with the
properties needed from frm1PollDatabase, destroy or continue with
frm1PollDatabase and then show frm1Modify as a dialogue from the main form.
This seems to do the trick without all the unecessary threading.

Is there any reason why you have to thread?

Robby
 
C

Charles A. Lackman

Hello,

Yes, this is how I originally programed it and it does not work the way I
need it two.
I raise the event in the Main form, where at the AddressOf the
frm1Modify.ShowDialog is shown. This causes frm1PollDatabase to become
unusable (because of the ShowDialog). The only way I have been able to get
the right effect is to SHOW the form. But then I have to recreate it
everytime I need to use it, because when it is closed it is destroyed. I
could capture the Closing event can cause the form to hide instead, which
might be what I have to do, if I can't find a work around.

We are getting closer, I think.

Thanks,

Chuck
 
G

Guest

As a general rule it's rare that you would need to use more than one UI
thread in your application. I only know of couple ones, for example Windows
Explorer, or a game with multiple users. Also think somebody will have to
maintain your code and will have difficulty understanding it and/or why you
needed extra UI threads, if any at all. Also once you get into threading you
need to deal with synchronization which can mean that unless you know exactly
what you are doing you will end up chasing bugs for days to come. For desktop
applications I often ask do I need to get fancy, and if threads can be
avoided, and sometimes a call to DoEvents can often save the headache. My 2
cents.
 
C

Cor Ligthert

Charles,

Will you be so kind to stay in the original threads, than questions can be
followed up, now you make that almost impossible and have others every time
to start new, what cost in my opinion too much time searching for your
original questions and answers on that.

Cor

"Charles A. Lackman" <[email protected]>

...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top