473,503 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Execute Code after showDialog()

Hi

I have a Windows Form (myForm()) doing somethig.
myForm() should be modal.
Normaly the action initated by user - pressing a Button, callling
myForm:DoSomething()

Now i will use the same Form like "batch-processing", starting
:DoSomething() in my code:

It'c clear to me that the following code can not work:

myForm:ShowDialog();
myForm:DoSomething()

--> what is the best way to do this ?

- Is there a "AfterShowEvent" ?, or which event is fired after dotnet
is "to be done doing everything with myDialog()"

- As well I think to use a timer....

Thanks
Peter

Nov 29 '05 #1
4 10406
Hi,
"Peter" <pR****@procom-gmbh.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
myForm:ShowDialog();
myForm:DoSomething()

--> what is the best way to do this ?


No clear why this cannot work, if you are going to implement it as a batch
it will have no user interaction, so most probably myForm will do something
(without requiring user interaction) and will return ( by calling
Form.Close ) so your code "may" work.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Nov 30 '05 #2
If you're doing batch processing, why does the form need to be modal
(or shown at all)? Just create it, manipulate the form, and then
dispose it. Or use Show(), manipulate it, then close it.

If that won't work, you can add a VisibleChanged event to the form:

using (MyForm frm = new MyForm()) {
frm.VisibleChanged += new EventHandler(MyFormVisibleChanged);
frm.ShowDialog();
frm.VisibleChanged -= new EventHandler(MyFormVisibleChanged);
}
....
private void MyFormVisibleChanged(object sender, EventArgs e) {
MyForm frm = sender as MyForm;
if (frm != null && frm.Visible) {
// do something with frm
}
}

Jesse

Nov 30 '05 #3
Good Joke...

my Code should not run after the dialog is closed. I look for a
possibility to start code "from the outside of myDialog" when myDialog
is active.

myForm:Show();
myForm:DoSomething()

do this, but then myDialog ist not modal.

Peter.

Dec 2 '05 #4
Hi,

You have to use a thread then, I'm still not clear of what you want,
If you want that DoSmething() is executed when the dialog is being
displayed you have two potions:
1- call DoSomething in the Form_load of the dialog
2- use a thread
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"Peter" <pR****@procom-gmbh.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Good Joke...

my Code should not run after the dialog is closed. I look for a
possibility to start code "from the outside of myDialog" when myDialog
is active.

myForm:Show();
myForm:DoSomething()

do this, but then myDialog ist not modal.

Peter.

Dec 2 '05 #5

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

Similar topics

3
2699
by: GATMAN | last post by:
Dim f As New frmWeb f.ShowDialog(Me) f.Dispose() Annytime i call a diffrent form from my main form using showdialog, i get an exception eror thrown when i close the form, but when i use f.show i...
3
2301
by: kathyk | last post by:
Hi All, I am using Access 2003 on machines with windows 2000 and XP. The problem I'm having started only after we got a new image for our PC's. This database app has been around for awhile and...
5
1578
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...
6
4892
by: Samuel R. Neff | last post by:
I'm having weird results with a form that is already displayed modally (via ShowDialog) displaying a second form via ShowDialog. The last form is not modal even though it's called with ShowDialog....
4
5214
by: trialproduct2004 | last post by:
Hi all I am new to vb.net application. I am using showdialog property of form to display form. First time it is working properly. But next time it is giving me error that ' object reference not...
6
2313
by: cj | last post by:
Lets just take this example I'm looking at now. I'm looking at the help screen titled .NET Framework Class Library FolderBrowserDialog Class . It gives an example at the bottom that begins with:...
0
824
by: martin.bonneville | last post by:
Hi, I have a .Net Form. When I call the ShowDialog from unmanaged code (C++ compiled in VS2005 /clr), the dialog don't appear... it seem to be behind the main window. If I change the...
3
1949
by: Franky | last post by:
Been having a problem using a treeview. Work great the first time the form containing it is entered but not the second time. Took a while to create a small sample that exhibits the problem, but...
1
15506
by: uday1302 | last post by:
I have 30 buttons and I am trying to implement context menu on each button click by using following method. void OnButtonClick(object sender, EventArgs e) { Button btn =...
0
7201
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7083
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
7278
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
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7456
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
5578
agi2029
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,...
1
5011
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...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
379
bsmnconsultancy
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...

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.