473,569 Members | 2,834 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:DoSometh ing()

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:ShowDial og();
myForm:DoSometh ing()

--> 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 10428
Hi,
"Peter" <pR****@proco m-gmbh.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
myForm:ShowDial og();
myForm:DoSometh ing()

--> 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.VisibleChan ged += new EventHandler(My FormVisibleChan ged);
frm.ShowDialog( );
frm.VisibleChan ged -= new EventHandler(My FormVisibleChan ged);
}
....
private void MyFormVisibleCh anged(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:DoSometh ing()

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****@proco m-gmbh.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.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:DoSometh ing()

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
2715
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 don't get any errors, i need the knew form to keep the focus until closed. thank you
3
2302
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 the code that is breaking was found on the internet by the developer who created the DB. The first error "Error # 29060 was genereated by migrated...
5
1584
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...
6
4898
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. For example, given three forms: Startup Pop1 Pop2
4
5221
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 set to an instance of an object'. When i went through stacktrace, i found that it is giving error in showwindow. I am not getting why it is...
6
2319
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: ' The following example displays an application that provides the ability to ' open rich text files (rtf) into the RichTextBox. The example...
0
829
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 property "TopMost" of the form... then it appear correctly but
3
1951
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 here it is. Seems to have something to do with doing ShowDialog Easy to reproduce this project, simply add two forms.
1
15516
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 = (Button)sender; btn.ContextMenuStrip.Show(btn, new System.Drawing.Point(0, btn.Height)); } I have 2 context menu strip items, Add...
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
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...
0
7917
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6277
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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...
0
3651
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...
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
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 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.