473,395 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Change Application Main Form

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

Loginform
Mainform
SettingForm

How can I set my Application Main Form to Mainform?
Nov 16 '05 #1
3 21683
Arda Han wrote:
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....=de&ref=usenet
Nov 16 '05 #2
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]
Nov 16 '05 #3
Thans friends.

"Morten Wennevik" <Mo************@hotmail.com>, 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]
Nov 16 '05 #4

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

Similar topics

7
by: Alpha | last post by:
Hi, I just found out that I need a different form to run at the start of the application. How can I change the current form to not start and the new form to start? Thanks, Alpha
2
by: Gwl | last post by:
I'm writing an application in which the user can change the default ouput language while the program is running. I have no problem to do it when there is only a form opened, but if I have a...
3
by: Brad Rogers | last post by:
All, Being immersed in vb.net and trying CSharp after almost a year I forgot the differences. I like vb fixing the uppercase/lowercase names and seeming to be more flexible to code entry. ...
3
by: RBarryYoung | last post by:
How can I get the following two features in the same program in VS2005?: 1) Access to the command-line arguments (cmdArgs()) that started my App. 2) Shutdown Mode = "When last Form exits". ...
1
by: j_mmtz | last post by:
Hi, i need to change the internal name of an application VB Net in visual studio 2005, but i can't find this option if it exists, please can somebody help me?. thanks.
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
7
by: Jay | last post by:
In my C# code, I'm attempting to display a message box then quit the win form application I'm writing if a certain type of error occurs when the application starts up. In the main form's...
9
by: aleplgr | last post by:
Hi! I'm trying to let the end-user select the language of the menues I'm showing him. To do that I've got this Selector class that shows the end user a combo box, a label and a button. In the combo...
0
by: =?Utf-8?B?a20=?= | last post by:
I've got a simple C# app built in VS2005. When I click a menu item a modal form opens and performs a lengthy operation in the Load event handler to populate a text control, so it takes a few...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
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,...

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.