Change Application Main Form

  • Thread starter Thread starter Arda Han
  • Start date Start date
A

Arda Han

Hi friends I have 3 form in my solution.Their names :

Loginform
Mainform
SettingForm

How can I set my Application Main Form to Mainform?
 
Arda said:
Hi friends I have 3 form in my solution.Their names :

Loginform
Mainform
SettingForm

How can I set my Application Main Form to Mainform?

Hi Arda,

I guess you mean the form that is displayed when the application starts
up. Anywhere in your project, there must be lines like this:

static void Main()
{
...
Application.Run(new xxxForm());
...
}

Replace the concerned line with this:

Application.Run(new MainForm());

and it should be done.

Best regards,

Michael

--
How to contact me
~~~~~~~~~~~~~~~~~
directly via mail: remove the "NOTUSEABLE" and the point after it and
reverse the characters
via my portal: go to
http://great.dynu.com/tools/contact.4s?lang=de&ref=usenet
 
Hi Arda,

If you want to implement a login feature ending up with a main form you
can try to use a showdialog on your loginform before starting the mainform.

For instance:

static void Main()
{
LoginForm login = new LoginForm();
if(login.ShowDialog() == DialogResult.OK)
{
Application.Run(new MainForm(login.UserName));
}
}

In your loginform you do the validation and store the user info in some
property (I used UserName in this example). If the validation is ok set
DialogResult for the LoginForm to OK or some value of choice and just
close it. You can then start the MainForm. If not validated, mainform
will never show.

There are other solution that might suit you better.

Happy coding!
Morten Wennevik [C# MVP]
 
Thans friends.

"Morten Wennevik" <[email protected]>, haber iletisinde sunlari
yazdi:opr6qsj5vjhntkfz@localhost...
Hi Arda,

If you want to implement a login feature ending up with a main form you
can try to use a showdialog on your loginform before starting the mainform.

For instance:

static void Main()
{
LoginForm login = new LoginForm();
if(login.ShowDialog() == DialogResult.OK)
{
Application.Run(new MainForm(login.UserName));
}
}

In your loginform you do the validation and store the user info in some
property (I used UserName in this example). If the validation is ok set
DialogResult for the LoginForm to OK or some value of choice and just
close it. You can then start the MainForm. If not validated, mainform
will never show.

There are other solution that might suit you better.

Happy coding!
Morten Wennevik [C# MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top