473,569 Members | 2,466 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.WriteLi ne("test") instead of a MessageBox the form is
not closed....)
Help....
Cybertof.

Nov 15 '05 #1
3 3690
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.WriteLi ne("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*******@discu ssions.microsof t.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.micros oft.com...
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
2706
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: when the user clicks a button in the main window, a dialog window pops up. In the dialog the user enters a university to search for. When the string...
3
2976
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? as Access dose not show you. DD
5
2207
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 printer-friendly report is not the best way to go. So, I tried converting one of my Access reports to an Access form. I selected the continuous view...
4
7129
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 serialize the data to put the array into the cookie. That part of my code is working just fine and displaying fine. The problem I’m having is when I...
4
1810
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, configured, dragged an Dataadapter per each table I need it, then generated the dataset, after that, I stablished the relations between tables,...
2
3140
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 then the calender gone actually i want if i click outside off the calender then it should me removed ..How kan i do this ... Pls inform me as early...
2
1930
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 catch more eyes and find someone who had the same problem and solved it or has more information about it. This is a summary of my problem:
14
4568
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 another group member at that time, but it's hardly ideal. MS should really look at this and fix it. When a form containing a chart is opened...
1
2512
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 PC and sometimes when i start or restart the PC i have observed that even though the long process is completed splash
0
7618
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
7926
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
8132
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7982
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5222
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
3656
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...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
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 we have to send another system
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.