Hi. I'm trying to launch a second form from code in a first, but it doesn't
seem to working.
Originally I tried to write the code as follows (Form2 has a public method
called AttachDataSet):
Application.Run(new Form2());
Form2.AttachDataSet(ds);
Form2.Show();
However, Intellisense couldn't find the AttachDataSet method using that
code. So I changed it to:
Form2 fm2 = new Form2();
Application.Run(fm2);
fm2.AttachDataSet(ds);
fm2.Show();
But when the code runs, nothing seems to happen. Further, if I put a break
point at fm2.Show, I never get there.
Anybody know (a) what's going on in my current code, and (b) how to do what
I want?
Thanks...
Dan 5 15103
Hi Dan,
Put the line AttachDataSet(ds); into Form2's constructor and change your
code to:
Form2 fm2 = new Form2(); Application.Run(fm2); // fm2.Show(); don't need this
Call to Application.Run(fm2); won't return until frm2 is closed.
--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com www.rthand.com
"Dan" <da*@dontspamme.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... Hi. I'm trying to launch a second form from code in a first, but it
doesn't seem to working.
Originally I tried to write the code as follows (Form2 has a public method called AttachDataSet):
Application.Run(new Form2()); Form2.AttachDataSet(ds); Form2.Show();
However, Intellisense couldn't find the AttachDataSet method using that code. So I changed it to:
Form2 fm2 = new Form2(); Application.Run(fm2); fm2.AttachDataSet(ds); fm2.Show();
But when the code runs, nothing seems to happen. Further, if I put a
break point at fm2.Show, I never get there.
Anybody know (a) what's going on in my current code, and (b) how to do
what I want?
Thanks...
Dan
Thanks Miha. If I wanted to launch the form and continuing executing (i.e.
launch the form non-modally), how would I do that?
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:eS**************@TK2MSFTNGP12.phx.gbl... Hi Dan,
Put the line AttachDataSet(ds); into Form2's constructor and change your code to:
Form2 fm2 = new Form2(); Application.Run(fm2); // fm2.Show(); don't need this
Call to Application.Run(fm2); won't return until frm2 is closed.
-- Miha Markic [MVP C#] - RightHand .NET consulting & software development miha at rthand com www.rthand.com
"Dan" <da*@dontspamme.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Hi. I'm trying to launch a second form from code in a first, but it doesn't seem to working.
Originally I tried to write the code as follows (Form2 has a public
method called AttachDataSet):
Application.Run(new Form2()); Form2.AttachDataSet(ds); Form2.Show();
However, Intellisense couldn't find the AttachDataSet method using that code. So I changed it to:
Form2 fm2 = new Form2(); Application.Run(fm2); fm2.AttachDataSet(ds); fm2.Show();
But when the code runs, nothing seems to happen. Further, if I put a break point at fm2.Show, I never get there.
Anybody know (a) what's going on in my current code, and (b) how to do what I want?
Thanks...
Dan
If you are already in a form's code (inside Form1.xxx()), then get rid of
the Application.Run(),
public void OpenForm()
{
Form2 fm2 = new Form2();
fm2.AttachDataSet(ds);
fm2.Show();
}
Application.Run should only show up once in your app - normally in your
"main".
"Dan" <da*@dontspamme.com> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl... Thanks Miha. If I wanted to launch the form and continuing executing
(i.e. launch the form non-modally), how would I do that?
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:eS**************@TK2MSFTNGP12.phx.gbl... Hi Dan,
Put the line AttachDataSet(ds); into Form2's constructor and change your code to:
Form2 fm2 = new Form2(); Application.Run(fm2); // fm2.Show(); don't need this
Call to Application.Run(fm2); won't return until frm2 is closed.
-- Miha Markic [MVP C#] - RightHand .NET consulting & software development miha at rthand com www.rthand.com
"Dan" <da*@dontspamme.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... Hi. I'm trying to launch a second form from code in a first, but it doesn't seem to working.
Originally I tried to write the code as follows (Form2 has a public method called AttachDataSet):
Application.Run(new Form2()); Form2.AttachDataSet(ds); Form2.Show();
However, Intellisense couldn't find the AttachDataSet method using
that code. So I changed it to:
Form2 fm2 = new Form2(); Application.Run(fm2); fm2.AttachDataSet(ds); fm2.Show();
But when the code runs, nothing seems to happen. Further, if I put a break point at fm2.Show, I never get there.
Anybody know (a) what's going on in my current code, and (b) how to do what I want?
Thanks...
Dan
Hi,
Philip is absolutely right - Application.Run is used for application to know
when it should close you application (when the form you pass is closed).
--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com www.rthand.com
"Philip Rieck" <st***@mckraken.com> wrote in message
news:Ox**************@TK2MSFTNGP11.phx.gbl... If you are already in a form's code (inside Form1.xxx()), then get rid of the Application.Run(),
public void OpenForm() { Form2 fm2 = new Form2(); fm2.AttachDataSet(ds); fm2.Show(); }
Application.Run should only show up once in your app - normally in your "main".
"Dan" <da*@dontspamme.com> wrote in message news:Oc**************@TK2MSFTNGP09.phx.gbl... Thanks Miha. If I wanted to launch the form and continuing executing (i.e. launch the form non-modally), how would I do that?
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:eS**************@TK2MSFTNGP12.phx.gbl... Hi Dan,
Put the line AttachDataSet(ds); into Form2's constructor and change
your code to:
Form2 fm2 = new Form2(); > Application.Run(fm2); > // fm2.Show(); don't need this
Call to Application.Run(fm2); won't return until frm2 is closed.
-- Miha Markic [MVP C#] - RightHand .NET consulting & software
development miha at rthand com www.rthand.com
"Dan" <da*@dontspamme.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... > Hi. I'm trying to launch a second form from code in a first, but it doesn't > seem to working. > > Originally I tried to write the code as follows (Form2 has a public method > called AttachDataSet): > > Application.Run(new Form2()); > Form2.AttachDataSet(ds); > Form2.Show(); > > However, Intellisense couldn't find the AttachDataSet method using that > code. So I changed it to: > > Form2 fm2 = new Form2(); > Application.Run(fm2); > fm2.AttachDataSet(ds); > fm2.Show(); > > But when the code runs, nothing seems to happen. Further, if I put
a break > point at fm2.Show, I never get there. > > Anybody know (a) what's going on in my current code, and (b) how to
do what > I want? > > Thanks... > > Dan > >
Thanks a lot guys.
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:O1**************@TK2MSFTNGP12.phx.gbl... Hi,
Philip is absolutely right - Application.Run is used for application to
know when it should close you application (when the form you pass is closed).
-- Miha Markic [MVP C#] - RightHand .NET consulting & software development miha at rthand com www.rthand.com
"Philip Rieck" <st***@mckraken.com> wrote in message news:Ox**************@TK2MSFTNGP11.phx.gbl... If you are already in a form's code (inside Form1.xxx()), then get rid
of the Application.Run(),
public void OpenForm() { Form2 fm2 = new Form2(); fm2.AttachDataSet(ds); fm2.Show(); }
Application.Run should only show up once in your app - normally in your "main".
"Dan" <da*@dontspamme.com> wrote in message news:Oc**************@TK2MSFTNGP09.phx.gbl... Thanks Miha. If I wanted to launch the form and continuing executing (i.e. launch the form non-modally), how would I do that?
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message news:eS**************@TK2MSFTNGP12.phx.gbl... > Hi Dan, > > Put the line AttachDataSet(ds); into Form2's constructor and change your > code to: > > Form2 fm2 = new Form2(); > > Application.Run(fm2); > > // fm2.Show(); don't need this > > > Call to Application.Run(fm2); won't return until frm2 is closed. > > -- > Miha Markic [MVP C#] - RightHand .NET consulting & software development > miha at rthand com > www.rthand.com > > "Dan" <da*@dontspamme.com> wrote in message > news:%2****************@TK2MSFTNGP10.phx.gbl... > > Hi. I'm trying to launch a second form from code in a first, but
it > doesn't > > seem to working. > > > > Originally I tried to write the code as follows (Form2 has a
public method > > called AttachDataSet): > > > > Application.Run(new Form2()); > > Form2.AttachDataSet(ds); > > Form2.Show(); > > > > However, Intellisense couldn't find the AttachDataSet method using that > > code. So I changed it to: > > > > Form2 fm2 = new Form2(); > > Application.Run(fm2); > > fm2.AttachDataSet(ds); > > fm2.Show(); > > > > But when the code runs, nothing seems to happen. Further, if I
put a > break > > point at fm2.Show, I never get there. > > > > Anybody know (a) what's going on in my current code, and (b) how
to do > what > > I want? > > > > Thanks... > > > > Dan > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michael H |
last post by:
I have a strange error occuring in my winforms app that I can't seem to find any fix for.
With a button click I am launching something like the following:
string url ="http://www.microsoft.com"...
|
by: Tim Stevens |
last post by:
Hello,
This is the first time I have had to resort to posting on here, as Ive
always been able to find a solution to my problems in the past by
browsing postings by others. So, to start with I...
|
by: Muscha |
last post by:
Hello,
How do I launch an IE instance with the URL as the parameter from my windows
form? I have the axWebBrowser control, should I use that one?
Thanks,
/m
|
by: Robert Misiak |
last post by:
In a program that I wrote, it is very important for the user to have the
correct time zone configured. As such, in its properties window I display
the current configured time zone, and if it is...
|
by: dhussong |
last post by:
I have created a Setup and Deployment project in Visual Studio.NET 2003.
After my installation has completed running I'd like to launch the EXE that I
just
installed. I've found how to launch the...
| |
by: microb0x |
last post by:
Is there any difference in the way an Access .mdb file is launched from
directly double-clicking the file through windows explorer versus using
code within another Access file to launch the...
|
by: vol30w60 |
last post by:
Hi folks,
I am trying to launch a program with PHP code. I am running Apache on
Windows XP SP2.
I am using the method noted here:
http://us2.php.net/manual/en/function.exec.php#59428
To...
|
by: kimiraikkonen |
last post by:
Hi experts,
I just want to ask a simple procedure of my simple form. My form has a
input textbox and a button.
I want this if you can help me:
Application user types a command prompt command...
|
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= |
last post by:
I have a WinForm application that, depending on user actions, may spin for a
while doing extensive calculations, showing a progress bar in the meantime.
I would like to be able to launch a second...
|
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,...
|
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...
| |
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,...
|
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,...
|
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...
|
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...
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |