473,508 Members | 2,434 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Displaying a form after another form

Hello,

I have a strange behavior.

On a MyForm form, i have a button with this code
----> MessageBox.Show("hello");
When i start the project with this single form
----> Application.Run(new MyForm());
It works : when i click then i have the messagebox and the form still
continues its message loop.
Now if before displaying MyForm, i display another one, when i click the
button, the MessageBox appears, but once clicking OK, the form is closed
! (and no call to this.Close() was done.....)
***************
Sample Code :
***************
//[STAThread]
static void Main(string[] cmdLine )
{
Application.Run(new MyFirstForm()); // (***)
Application.Run(new MyForm());
}

(***) with this line, any click on a button in MyForm to display a
MessageBox will close MyForm.
(if i use Console.WriteLine("test") instead of a MessageBox the form is
not closed....)
Help....
Cybertof.

Nov 15 '05 #1
3 3687
Its your program, and not you who shows a strange
behaviour isn't it? :)

-----Original Message-----
Hello,

I have a strange behavior.

On a MyForm form, i have a button with this code
----> MessageBox.Show("hello");
When i start the project with this single form
----> Application.Run(new MyForm());
It works : when i click then i have the messagebox and the form stillcontinues its message loop.
Now if before displaying MyForm, i display another one, when i click thebutton, the MessageBox appears, but once clicking OK, the form is closed! (and no call to this.Close() was done.....)
***************
Sample Code :
***************
//[STAThread]
static void Main(string[] cmdLine )
{
Application.Run(new MyFirstForm()); // (***)
Application.Run(new MyForm());
}

(***) with this line, any click on a button in MyForm to display aMessageBox will close MyForm.
(if i use Console.WriteLine("test") instead of a MessageBox the form isnot closed....)
Help....
Cybertof.

.

Nov 15 '05 #2
Sorry ?

I just want a 'Login' form to identify the user, and once the
identification is ok, then only displays the real main form....

Cybertof.
In article <00****************************@phx.gbl>,
an*******@discussions.microsoft.com says...
Its your program, and not you who shows a strange
behaviour isn't it? :)

Nov 15 '05 #3
"Cybertof" <cy****************@gmx.net> wrote in message
news:MP************************@msnews.microsoft.c om...
I have a strange behavior.


Make sure you are setting the DialogResult member and calling Close() from
the dialog class.

-- Alan
Nov 15 '05 #4

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

Similar topics

6
2701
by: Shaun Fleming | last post by:
I've been trying to make this simple script compatible across various browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I have version 7.11). This is what is supposed to happen:...
3
2970
by: DD | last post by:
I want to link a form to another form by a Cmd Button. CustomerID = CustomerID I want the form to open from the Cmd Button as if it was acting in the same way as subform What would be the code?...
5
2201
by: Robert | last post by:
Hello Accessors I have some reports created in Access that are very good for what they do. However, it seems to me that when you are displaying information you don't need to print out that a...
4
7116
by: MrL8Knight | last post by:
Hello, I am trying to build a simple php form based shopping cart using a cookie with arrays. I need to use 1 cookie because each order will have over 20 items. With that said, I realize I need to...
4
1807
by: JJGarcia | last post by:
Hi Everyone, I'll try to explain the process I'm following, I'm new to this so I'm triying the easy way first, probably the lasyest too! I created a new Project, drag in to it a SQLConnection,...
2
3135
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button...
2
1927
by: =?Utf-8?B?aGVsZmk=?= | last post by:
Hi all, I have replied with my own questions to an older post entry but after a while I thought it's better to start a new thread based on the previous one. Perhaps with the new thread I will...
14
4556
by: Wayne | last post by:
I posted about this problem over 12 months ago and even after Vista SP1 the problem still exists when running an Access database (A2003 and A2007 tested) under Vista. A workaround was suggested by...
1
2508
by: raghudr | last post by:
Hi all, I am displaying a splash screen for which i have created a thread.Since my whole project is launched by windows service and that service will start automatically at the start of the...
0
7224
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
7323
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
7379
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
7493
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
5625
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,...
0
4706
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...
0
3192
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...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
415
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.