473,511 Members | 15,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

changing the main form

Hello!!

I've just started a new windows form in C#, but when I finished my Form1, I
remembered that I would like to add a new form to login to the App.

So, I need to load first a Form2, and if I login succesfully, show Form1.

¿How could I change the App, to load Form2, and not Form1?

Thanks.
Jun 27 '08 #1
5 1732
On Wed, 28 May 2008 14:44:29 -0700, Jordi Maicas
<jm***********@hotmail.comwrote:
I've just started a new windows form in C#, but when I finished my
Form1, I
remembered that I would like to add a new form to login to the App.

So, I need to load first a Form2, and if I login succesfully, show Form1.

¿How could I change the App, to load Form2, and not Form1?
Just edit the Main() method in your Program.cs file to suit your needs.

And rename both your forms so that they have more meaningful names. :)

Pete
Jun 27 '08 #2
In the Program.cs class there would be Main function something like
below

static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new Form1());
}

Change the Application.Run(new Form1()); line to reflect to the login
form.... something like

Application.Run(new LoginForm());
This should work.

Thanks
-Cnu
On May 29, 2:44*am, "Jordi Maicas" <jmaycasNOS...@hotmail.comwrote:
Hello!!

I've just started a new windows form in C#, but when I finished my Form1, I
remembered that I would like to add a new form to login to the App.

So, I need to load first a Form2, and if I login succesfully, show Form1.

¿How could I change the App, to load Form2, and not Form1?

Thanks.
Jun 27 '08 #3
I've got the following error:

Program.cs(18,33): error CS0246: The type or namespace name 'Form2' could
not be found (are you missing a using directive or an assembly reference?)

And in the Solution Explorer, I see Form2.

Any ideas?

"Duggi" <Du***************@gmail.comescribió en el mensaje
news:86**********************************@56g2000h sm.googlegroups.com...
In the Program.cs class there would be Main function something like
below

static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new Form1());
}

Change the Application.Run(new Form1()); line to reflect to the login
form.... something like

Application.Run(new LoginForm());
This should work.

Thanks
-Cnu
On May 29, 2:44 am, "Jordi Maicas" <jmaycasNOS...@hotmail.comwrote:
Hello!!

I've just started a new windows form in C#, but when I finished my Form1,
I
remembered that I would like to add a new form to login to the App.

So, I need to load first a Form2, and if I login succesfully, show Form1.

¿How could I change the App, to load Form2, and not Form1?

Thanks.

Jun 27 '08 #4
On Thu, 29 May 2008 14:38:41 -0700, Jordi Maicas
<jm***********@hotmail.comwrote:
I've got the following error:

Program.cs(18,33): error CS0246: The type or namespace name 'Form2' could
not be found (are you missing a using directive or an assembly
reference?)
Well...is Form2 in the same namespace as Form1? If not, you need to
either fully qualify the type name, or include a using directive (just as
the error tells you).

It's not really possible with the information given here for any of us to
explain the exact error with certainty. You may want to consider looking
more closely at the error and your own code and its structure and see if
you can figure it out yourself. You'll have a lot of problems down the
road if you don't get comfortable dealing with basic compile errors like
this on your own.

Pete
Jun 27 '08 #5
I solved.

Thanks.

"Peter Duniho" <Np*********@nnowslpianmk.comescribió en el mensaje
news:op***************@petes-computer.local...
On Thu, 29 May 2008 14:38:41 -0700, Jordi Maicas
<jm***********@hotmail.comwrote:
>I've got the following error:

Program.cs(18,33): error CS0246: The type or namespace name 'Form2' could
not be found (are you missing a using directive or an assembly
reference?)

Well...is Form2 in the same namespace as Form1? If not, you need to
either fully qualify the type name, or include a using directive (just as
the error tells you).

It's not really possible with the information given here for any of us to
explain the exact error with certainty. You may want to consider looking
more closely at the error and your own code and its structure and see if
you can figure it out yourself. You'll have a lot of problems down the
road if you don't get comfortable dealing with basic compile errors like
this on your own.

Pete

Jun 27 '08 #6

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

Similar topics

3
1192
by: Tony | last post by:
Hi, How do you change the main form in visual basic .net 2003? I have a form1 as the startup form. Based on a user response as to which mode to run the program in, i would like to transfer...
4
1912
by: Brad Jones | last post by:
<Previously posted in microsoft.public.dotnet.framework.windowsforms> Hi all. Any suggestions here would be appreciated. Thanks for reading. I'm primarly a C++ developer but I've been trying to...
7
8485
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
32
3636
by: deko | last post by:
I have a popup form with a textbox that is bound to a memo field. I've been warned about memo fields so I'm wondering if I should use this code. Is there any risk with changing the form's...
3
1707
by: john | last post by:
I have a form with Members and in that form a subform with Transactions. Those are linked (on banknr) 1xM which I've set in the database relations. Now I would like to copy the form and modify it....
11
7639
by: Toby | last post by:
I am a little new as you can tell by this post. This is my first c# window app and I made all my forms and now trying to go back and change the start up form and it is giving me errors when I...
2
2319
by: G Gerard | last post by:
Hello I have noticed that whenever I set a form's RecordSource property in code it launches the form's OnActivate event. In one of my application I set a form's RecordSource to zero lenght...
22
3036
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
3
8531
by: jimatqsi | last post by:
I'm having trouble changing the focus from form to form. I've got a big form with two smaller forms. The main form takes the left 1/3 of the screen, subform1 the upper right, and subform2 the...
8
4332
Megalog
by: Megalog | last post by:
Hey guys.. my turn to ask a question: I'm having a weird issue with a form I've reworked. This form has a combo box, which when used is changing the recordsource of a subform. This subform has...
0
7242
marktang
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,...
0
7508
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
5662
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,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3222
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...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1572
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 ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.