473,574 Members | 2,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ShowDialog question

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

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


Richard Rosenheim
Jul 21 '05 #1
3 3656

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 showdialogopera tor with me/this.
Which set the parent of the form.

I hope this helps?

Jul 21 '05 #2

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
Return MyBase.ShowDial og()
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
Return MyBase.ShowDial og()
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

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

Richard Rosenheim

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:e9******** ******@TK2MSFTN GP09.phx.gbl...

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 showdialogopera tor with me/this.
Which set the parent of the form.

I hope this helps?


Jul 21 '05 #3

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

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

Jul 21 '05 #4

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

Similar topics

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 question is if I want to start a System.Windows.Forms.Form via ShowDialog in another thread what is the best way to do it? Basically, I want to start a...
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 second consecutive call, which goes against the principles of the ShowDialog function. Does anyone know a work around that still allow the for the...
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 code: Dim frm_Zip As New frmZIP frm_Zip.ShowDialog()
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 catch, form 2 closes and disposes the instance of form 3, opens itself as showdialog, and displays some data to the user. the user can select one...
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). In this medium sized (30 or so forms) application, our users have requested a more visual notification of when the client (this app) is...
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 vb.net that doesnt seem to do alot most of the time so far as i can tell. So im using form.showdialog all the time. But it seems as though once i call...
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
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 have a form that has a button. ( this form is a child form of a parent form ( main form ). Anway...in this child form I have a button, and if clicked...
by: shark | last post by:
Hi, Does Form.ShowDialog() start new thread ? If yes how is solved cross-thread operations? Thx
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.