473,326 Members | 2,012 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,326 software developers and data experts.

Changing Forms Issue

In my app I have a form that after the user hits ok switches to another
form, never to return to the first form again.

I thought this code would do the trick:

UserInfo child = new UserInfo();
child.Show();
this.Visible = false;

And it works fine except that when I close the UserInfo form the app remains
open, it's just not visible. What's the better way to handle this?

Steve
Sep 20 '06 #1
3 1009
You should show the first form as a dialo with ShowDialog() from Main, then
when OK is clicked, Open the seconds form and application.Run(secondform) so
it controls the message loop and closes the app when it closes.

Ciaran O'Donnell.

"-Steve-" wrote:
In my app I have a form that after the user hits ok switches to another
form, never to return to the first form again.

I thought this code would do the trick:

UserInfo child = new UserInfo();
child.Show();
this.Visible = false;

And it works fine except that when I close the UserInfo form the app remains
open, it's just not visible. What's the better way to handle this?

Steve
Sep 21 '06 #2
Okay the two forms in question are UserInfo and RunAs. I want RunAs to
display first, and then go to UserInfo.

In Program.cs I switched to Application.Run(new UserInfo());

Then in the constructor of UserInfo I changed it to:

public UserInfo()
{
InitializeComponent();
ShowDialog(new RunAs());
}

But what happens now is that when I run the app it shows me the UserInfo
form, then when I close that form it shows me another instance of the
UserInfo form.

Steve

"Ciaran O''Donnell" <Ci************@discussions.microsoft.comwrote in
message news:4E**********************************@microsof t.com...
You should show the first form as a dialo with ShowDialog() from Main,
then
when OK is clicked, Open the seconds form and application.Run(secondform)
so
it controls the message loop and closes the app when it closes.

Ciaran O'Donnell.

"-Steve-" wrote:
>In my app I have a form that after the user hits ok switches to another
form, never to return to the first form again.

I thought this code would do the trick:

UserInfo child = new UserInfo();
child.Show();
this.Visible = false;

And it works fine except that when I close the UserInfo form the app
remains
open, it's just not visible. What's the better way to handle this?

Steve

Sep 21 '06 #3
PS

"-Steve-" <ne********@planetevans.comwrote in message
news:uX**************@TK2MSFTNGP05.phx.gbl...
Okay the two forms in question are UserInfo and RunAs. I want RunAs to
display first, and then go to UserInfo.
Application.Run(new RunAs());
Application.Run(new UserInfo());

PS

>
In Program.cs I switched to Application.Run(new UserInfo());

Then in the constructor of UserInfo I changed it to:

public UserInfo()
{
InitializeComponent();
ShowDialog(new RunAs());
}

But what happens now is that when I run the app it shows me the UserInfo
form, then when I close that form it shows me another instance of the
UserInfo form.

Steve

"Ciaran O''Donnell" <Ci************@discussions.microsoft.comwrote in
message news:4E**********************************@microsof t.com...
>You should show the first form as a dialo with ShowDialog() from Main,
then
when OK is clicked, Open the seconds form and application.Run(secondform)
so
it controls the message loop and closes the app when it closes.

Ciaran O'Donnell.

"-Steve-" wrote:
>>In my app I have a form that after the user hits ok switches to another
form, never to return to the first form again.

I thought this code would do the trick:

UserInfo child = new UserInfo();
child.Show();
this.Visible = false;

And it works fine except that when I close the UserInfo form the app
remains
open, it's just not visible. What's the better way to handle this?

Steve

Sep 21 '06 #4

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

Similar topics

7
by: Stefan Finzel | last post by:
Hi, is there a way to change the display property on Windows Mobile 2003 SE Mobile/Pocket Internet Explorer? See following example. Please note: visibilty property has the same problem. Is...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
2
by: S P Arif Sahari Wibowo | last post by:
Hi! Do you know how to put a form's Access-Visual-Basic-code that will force the form to be inserted, while the user has not type anything in the form, without changing focus, selection, etc.? ...
6
by: John Ortt | last post by:
Hi there everyone, I have a part info form which has a faded image of our company logo as a background. I want to replace the faded image with a bright red warning image on items which have run...
7
by: dlinetsky | last post by:
I have a C# web app that uses mixed mode authentication (windows integrated auth. together with formsAuthentication). I would like to have a form that allows users to change their windows...
2
by: Grzegorz Kaczor | last post by:
Hello, I have an ASP.NET application in my website in virtual folder A. This folder contains the application itself. I also have a data virtual directory B which contains data that can be seen...
7
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
32
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's...
12
by: GaryDean | last post by:
In the original post I failed so indicate that I am using framework 1.1....... I need to be able to change the background color of a page from code. I found an answer to this question in...
8
Megalog
by: Megalog | last post by:
Hey guys.. my turn to ask a question: I'm having a weird issue with a form I've reworked. This form has a combo box, which when used is changing the recordsource of a subform. This subform has...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.