473,242 Members | 3,767 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,242 software developers and data experts.

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 10362
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
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
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
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
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
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
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
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
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
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 =...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.