HAI,
I AM DEVELOPING WINDOWS APPLICATION IN VB.NET IN MY PROJECT I WANT OPEN ONE FORM WHEN THE LOGIN IS SUCCESS BUT LOGIN FORM IS STILL ALIVE I WANT CLOSE THAT LOGIN FORM AS WELL AS OPEN THE OTHER FORM WHAT IS THE SOLUTION GIVE THE RIGHT SUGGESTION IF ANY ONE HAVE IDEA ON WINDOWS APPLICATION
Loading
Tomasz KornackiPosted Jul 29, 2010, 9:24 AM
public partial class MainForm: Form
{
LoginForm f;
object customData;
public MainForm()
{
f = new LoginForm();
f.ShowDialog(this);
objectCustomData = f.CustomProperty;
InitializeComponent();
}
}
And after succesfull login you should call this.Close() inside LoginForm. To collect data from LoginForm (like login information) define as many properties as you need.
Cheers
Tomek K.
Hiren SoniPosted Jul 26, 2010, 9:13 AM
Koteswararao MallisettiPosted Jul 26, 2010, 8:55 AM
DMR SantoshPosted Jul 26, 2010, 8:41 AM
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
Form f = new Form();
f.Show();
f.FormClosed += new FormClosedEventHandler(f_FormClosed);
}
void f_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
}
Regards,
D.M.R.Santosh
DMR SantoshPosted Jul 26, 2010, 8:24 AM
You can do like this ::
this.Hide();
Form f = new Form();
f.Show();
under the button click
then the form1 will hide and shows you the new form, when you want to close the form
then you can write as Application.close();
Regards,
D.M.R.Santosh
Hiren SoniPosted Jul 26, 2010, 7:35 AM
or
you can do onething.
in main form( means page which opens after successful login).
you can take one bool variable loggedin.
in that form_load you can check whether the user has logged in or not using loggedin variable.
if not then open login window. and if user entered valid username and password then assign one variable "loggedin = true " in the main form.
if user entered wrong password then ask user to enter valid password or you can exit from the application.
---------
dont forget to accept answer, if it helps you.
Mamta MPosted Jul 26, 2010, 7:33 AM
-Mamta