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

ShowDialog question

I would like to detect when a form is invoked as the result of a ShowDialog
call.

Anyone have any ideas or suggestions on how to do that?

TIA,

Richard Rosenheim
Jul 21 '05 #1
3 3634
Richard,

Sometimes I see here messages I don't absolutly not understand.
Who is calling the form using a ShowDialog.

However you can always overload the showdialogoperator with me/this.
Which set the parent of the form.

I hope this helps?

Cor
Jul 21 '05 #2
Cor,

Yes, in re-reading it, it probably wasn't my clearest question. I was also
trying not to write a long winded question either (like this one).

As you know, when ShowDialog is invoked, (along with possibly doing other
things), it causes the form to be displayed. Then it waits until
DialogResult is assigned a value, at which point it returns the value to the
parent and exits.

I would like to detect when the form has been displayed, so that while
ShowDialog is waiting for the value of DialogResult to be assigned, my
dialog can do some processing. My processing routine would be displaying
status information, so I don't want the processing to begin before the form
is actually displayed.

So, I can't just do something like this:

Public Overloads Function ShowDialog() As DialogResult
DoProcessing
Return MyBase.ShowDialog()
End Function

Nor, do I know exactly what all ShowDialog does internally, so I don't think
I really want to anything like this:

Public Overloads Function ShowDialog() As DialogResult
Me.Show
DoProcessing
Return MyBase.ShowDialog()
End Function

One possible approach would be to enable a timer, allowing a little time to
elapse (hopefully enough time for the form to display) and then calling the
processing routine.

The approach I'm currently utilizing is to set a flag in the ShowDialog
event, and then having the Activated event invoke the processing routine
when the flag is set. I needed the flag to prevent the Activated event from
invoking the processing routine every time the form gets the focus. And by
initializing the flag in the ShowDialog event, the code will still work if
the same instance of the form ever gets invoked more than once by a call to
ShowDialog.

While this approach seems to work, I'm not sure if it's the proper or best
way of dealing with the problem. Hence, the reason behind my original
question.

Richard Rosenheim

"Cor Ligthert" <no************@planet.nl> wrote in message
news:e9**************@TK2MSFTNGP09.phx.gbl...
Richard,

Sometimes I see here messages I don't absolutly not understand.
Who is calling the form using a ShowDialog.

However you can always overload the showdialogoperator with me/this.
Which set the parent of the form.

I hope this helps?

Cor

Jul 21 '05 #3
Richard,

The showdialog is expresly created in this way that there is no processing
done.

What you ask is often thought, however think it again over what you want to
do, you are not the first.

Programming is mostly making a chain of from each other dependend
instructions (althoug that are very much repeated instructions). Although
you see a lot of multithreading in this newsgroup, is my expirience that
when I don't use queues it is in most cases hard to use multithreading on an
efficient way (This expirience is very old)

The route you are taking now, makes that your would do yourself the
synchronization. Probably will that take (to keep that working well) more
time than you need for building your program without that.

When you want it coute a coute, than you can make your own openfiledialog,
that would probably take less time than the path you try to achieve not.

Or as another approach start the process you want to do while the
OpenFileDialog is showed in a seperated thread.

I hope this gives some idea's

Cor
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: NanoWizard | last post by:
Enclosed below is a class that contains one member item called _frm. It is just a standard System.Windows.Forms.Form class defined elsewhere (just disregard the definition of the object). My...
1
by: Tim | last post by:
Dear All, I have discovered, to my dismay, that the ShowDialog function will not function correctly when used with the AnimateWindow API. The owned form is opened behind the owning form on the...
4
by: Mike | last post by:
Hi, I already asked such question and also got some comments but when I added details - no more responds. Ok, here the story: Main form starts the additional thread. The thread contain such...
5
by: Josh Golden | last post by:
3 forms. form 1, when button clicked instantiates form 2 which opens but is not shown. form 2 instantiates form 3 as showdialog. form 3 finishes, raises an event that form 2 catches. during the...
4
by: Dennis Sjogren | last post by:
Greetings! First, I'm not 100% sure where to post this question. I use VB.NET for this project, but it's really a design question (a question on which method to use when solving this problem). ...
4
by: Jm | last post by:
Hi all Im not sure of the best way to be displaying my forms and just want a bit of clarification. Being only recently moved to vb.net im still used to the old vb6 form.show method, now under...
3
by: Richard L Rosenheim | last post by:
I would like to detect when a form is invoked as the result of a ShowDialog call. Anyone have any ideas or suggestions on how to do that? TIA, Richard Rosenheim
5
by: Miro | last post by:
I will try my best to ask this question correctly. I think in the end the code will make more sence of what I am trying to accomplish. I am just not sure of what to search for on the net. I...
14
by: shark | last post by:
Hi, Does Form.ShowDialog() start new thread ? If yes how is solved cross-thread operations? Thx
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.