Hi.
Imagine a scene where the user input the username and password in a "Login"
form and when press the confirm button, another window is opened with the
"Main" form. After that, the "Login" form is "closed" automatically.
How can I do to close the "Login" form? If I use Login.Close() on the
button_click event, both forms are closed.
Thanks a lot.
Fabio Negri Cicotti 4 1936
Fabio,
I would just run two message loops. The code that VS.NET produces for
you looks like this:
// Run the message loop with a form.
Application.Run (new Form1());
There is nothing that stops you from doing this:
// The login form.
LoginForm pobjLoginForm = new LoginForm();
// Show the login form.
Application.Run (pobjLoginForm) ;
// Apply some logic here, based on the properties of the form, like if the
user succeeded in logging in or not.
// Run the main form here.
Application.Run (new MainForm());
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Fabio Negri Cicotti" <ci*****@hotmai l.com> wrote in message
news:uF******** ******@TK2MSFTN GP12.phx.gbl... Hi.
Imagine a scene where the user input the username and password in a
"Login" form and when press the confirm button, another window is opened with the "Main" form. After that, the "Login" form is "closed" automatically.
How can I do to close the "Login" form? If I use Login.Close() on the button_click event, both forms are closed.
Thanks a lot.
Fabio Negri Cicotti
Thanks for your reply Nicholas.
I have tried to do what you said, but I didn't get successful. I'm taking
the follow error message:
"Additional information: It is invalid to start a second message loop on a
single thread. Use Application.Run Dialog or Form.ShowDialog instead."
Any help is appreciated,
Fabio Negri Cicotti
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:Or******** *****@TK2MSFTNG P10.phx.gbl... Fabio,
I would just run two message loops. The code that VS.NET produces for you looks like this:
// Run the message loop with a form. Application.Run (new Form1());
There is nothing that stops you from doing this:
// The login form. LoginForm pobjLoginForm = new LoginForm();
// Show the login form. Application.Run (pobjLoginForm) ;
// Apply some logic here, based on the properties of the form, like if the user succeeded in logging in or not.
// Run the main form here. Application.Run (new MainForm());
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Fabio Negri Cicotti" <ci*****@hotmai l.com> wrote in message news:uF******** ******@TK2MSFTN GP12.phx.gbl... Hi.
Imagine a scene where the user input the username and password in a "Login" form and when press the confirm button, another window is opened with
the "Main" form. After that, the "Login" form is "closed" automatically.
How can I do to close the "Login" form? If I use Login.Close() on the button_click event, both forms are closed.
Thanks a lot.
Fabio Negri Cicotti
Hi, Fabio
that's exactly what you need - ShowDialog for login form.
What stops you to use it before doing Application.Run for main form?
HTH
Alex
"Fabio Negri Cicotti" <ci*****@hotmai l.com> wrote in message
news:OU******** ******@TK2MSFTN GP10.phx.gbl... Thanks for your reply Nicholas.
I have tried to do what you said, but I didn't get successful. I'm taking the follow error message:
"Additional information: It is invalid to start a second message loop on a single thread. Use Application.Run Dialog or Form.ShowDialog instead."
Any help is appreciated,
Fabio Negri Cicotti "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in message news:Or******** *****@TK2MSFTNG P10.phx.gbl... Fabio,
I would just run two message loops. The code that VS.NET produces
for you looks like this:
// Run the message loop with a form. Application.Run (new Form1());
There is nothing that stops you from doing this:
// The login form. LoginForm pobjLoginForm = new LoginForm();
// Show the login form. Application.Run (pobjLoginForm) ;
// Apply some logic here, based on the properties of the form, like if
the user succeeded in logging in or not.
// Run the main form here. Application.Run (new MainForm());
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Fabio Negri Cicotti" <ci*****@hotmai l.com> wrote in message news:uF******** ******@TK2MSFTN GP12.phx.gbl... Hi.
Imagine a scene where the user input the username and password in a "Login" form and when press the confirm button, another window is opened with the "Main" form. After that, the "Login" form is "closed" automatically.
How can I do to close the "Login" form? If I use Login.Close() on the button_click event, both forms are closed.
Thanks a lot.
Fabio Negri Cicotti
Fabio,
Interesting, what version of the framework are you running on? I am on
1.1, and it doesn't prevent me from doing this.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Fabio Negri Cicotti" <ci*****@hotmai l.com> wrote in message
news:OU******** ******@TK2MSFTN GP10.phx.gbl... Thanks for your reply Nicholas.
I have tried to do what you said, but I didn't get successful. I'm taking the follow error message:
"Additional information: It is invalid to start a second message loop on a single thread. Use Application.Run Dialog or Form.ShowDialog instead."
Any help is appreciated,
Fabio Negri Cicotti "Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in message news:Or******** *****@TK2MSFTNG P10.phx.gbl... Fabio,
I would just run two message loops. The code that VS.NET produces
for you looks like this:
// Run the message loop with a form. Application.Run (new Form1());
There is nothing that stops you from doing this:
// The login form. LoginForm pobjLoginForm = new LoginForm();
// Show the login form. Application.Run (pobjLoginForm) ;
// Apply some logic here, based on the properties of the form, like if
the user succeeded in logging in or not.
// Run the main form here. Application.Run (new MainForm());
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard. caspershouse.co m
"Fabio Negri Cicotti" <ci*****@hotmai l.com> wrote in message news:uF******** ******@TK2MSFTN GP12.phx.gbl... Hi.
Imagine a scene where the user input the username and password in a "Login" form and when press the confirm button, another window is opened with the "Main" form. After that, the "Login" form is "closed" automatically.
How can I do to close the "Login" form? If I use Login.Close() on the button_click event, both forms are closed.
Thanks a lot.
Fabio Negri Cicotti
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: marcelf3 |
last post by:
Hello..
This page opens a window with some information, but everytime the user
changes a field in the parent window, the child window needs to be
closed.
These 2 functions were supposed to do the work.
Nota() - opens new window.
fechaNota() - closes the window opened by Nota()
here is the code.
|
by: Jules Winfield |
last post by:
My WinForms application can have any number of top level forms open at a given time. If the user selects File|Exit, all of the forms are closed. The loop to close the forms looks something like this:
foreach(MyForm form in AllMyForms){
form.Close();
}
Application.Exit();
The OnClosing method is overridden in MyForm. If the user has made changes to his form, this method asks him if he'd like to:
a) save his changes
b) forget changes...
|
by: Chien Lau |
last post by:
Hi,
At a certain point in my application, I have access to a Form object. I
want to close that form:
form.Close();
There are any number of reasons why this form might not close. A common
reason might be that the user answered "No" when the form's OnClosing()
override asked him "Are you sure you want to close this form?"
|
by: Alice |
last post by:
Hi,
In my program, the user can navigate to many different
forms. When they go to the next form, I want the form they
have left to close.
However, the forms aren't closing. Can anyone tell me what
I'm doing wrong? Here is a sample snippet of code where
the user can return to the main form while simultaneously
closing the previous form.
|
by: Stan Sainte-Rose |
last post by:
Hi,
Which event is called when the user click on the close window icon (X) ?
I want, when he clicks on this icon, to display a message before closing the
form.
If he replys by No, I don't want to close the form.
Thks for your help
Stan
| |
by: Tom |
last post by:
Is there ANY easy way to close a MDI Child form in the middle of it's load?
For instance, during the Load event I find a need to close the form (for
whatever reason - maybe the user isn't ready for it yet, or it displays
another form and they hit cancel). In any event, I need to be able to cause
that MDI Child form to close. Just sticking Me.Close in there won't work,
generates an error (note however, that on a NON-MDI form this seems to...
|
by: AP |
last post by:
IS there a way to run a procedure if the users close access directly
rather than closing a menu screen that I have built? There is an event
that works on close for this form, but it doesnt seem to run if the
form is open and the suer just closes access all together, is there a
way around this?
Thanks
|
by: scott |
last post by:
I guess this is a simple one but I can't seem to get it to work. I want to
refresh an open form "onClose" of another.
I have a Close button on a form which has User Details on it. If I update
the data on that from, I want it to automatically refresh the details which
are shown on an open form.
I was going to use the default access code
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
|
by: rdemyan via AccessMonster.com |
last post by:
I need help with code to close two forms at the same time, FormA and FormB. I
need code that can be used from either form and needs to work with both a
'Close' button on each form as well as if the user clicks the 'X' in the
control box.
I have a function, IsObjectOpen, that can be used to check if a form is open.
The function is used as follows:
X = IsObjectOpen(FormName,2)
|
by: dan.c.roth |
last post by:
oForm.Close() vs this.Close() in a modal dialog.
oFrom.Close() calls Form.Dispose() but this.Close() ,say in the click
event of the Form, does not.
I can think of the reason for this but is this documented and if so can
someone give me the reference. And is this true for .net 1 and 2.
Thanks
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |