473,386 Members | 1,828 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,386 software developers and data experts.

Displaying a Form (C#.NET)

Greetings,

I have a "newbie" question regarding C#.NET. I am using the "Windows
Application" template and am simply trying to display a second form
("frmInstructions") once the user clicks a command button on the main form.
In the "Click" event of the command button, I have the following code:

Application.Run(new frmInstructions());

I have also tried "frmInstructions.ActiveForm.Show", but neither are
working. Can anyone tell me what I'm doing wrong?

Thanks in advance!
--
Sherwood
Jul 21 '05 #1
1 1161
You shouldn't use the Application.Run again, it is used in main to start
your application (sort of like your "main" entry point and getting the event
loop started). Here is a sample:

on your OnClick event of the main Form:

Form2 form2 = new Form2(this);
Form2.ShowDialog(); // if its a dialog box

or

Form2.Show(); // if its not a dialog

Alex

"Sherwood" <Sh******@discussions.microsoft.com> wrote in message
news:0B**********************************@microsof t.com...
Greetings,

I have a "newbie" question regarding C#.NET. I am using the "Windows
Application" template and am simply trying to display a second form
("frmInstructions") once the user clicks a command button on the main
form.
In the "Click" event of the command button, I have the following code:

Application.Run(new frmInstructions());

I have also tried "frmInstructions.ActiveForm.Show", but neither are
working. Can anyone tell me what I'm doing wrong?

Thanks in advance!
--
Sherwood

Jul 21 '05 #2

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

Similar topics

3
by: CJM | last post by:
I'm adding some extra features to an intranet-based ASP application... As part of the process, I thought I would give the html a mid-life upgrade, ie. remove much of the tag-soup, replace with...
1
by: Peter Schmitz | last post by:
Hi, how can I create a form that is always displayed at the right bottom of the screen (just above the systray)? Thanks, Peter
2
by: Agent Michael Scarn | last post by:
Hello, I need to be able to dynamically display all of the form names from a form I just submitted. I have a javascript which will display all the names of the form on the first page, but i...
1
by: Spad2 | last post by:
Hi, I just wanted to know how to get form data (preferably using POST method, otherwise GET method would be fine) from an initial ASP page and validate it using VBScript on another ASP page and then...
2
Chittaranjan
by: Chittaranjan | last post by:
Hi All, I have a problem and hope I can get the better solution from here. I have a form written in HTML and I need to write that in perl so the main problem I am facing is that I need to...
1
by: mcfbern | last post by:
I am using a formmail.asp file to send html forms through email and then display a confirmation page to the user saying their information has been sent. Is there any way to display the information...
2
by: BrianT | last post by:
I'm trying to write an application in VB.NET that displays a single form on a second monitor only. So far, I've discovered that I can only have forms that are created during runtime (programatically)...
1
by: ColebyA | last post by:
Hi I am using ASP and HTML to process a form. The first form calls another page to process the data. When the page processes it redirects to a page confirming submission. I want to display the...
0
by: Jim in Arizona | last post by:
Is it just me or does IE7 not properly display controls done in ASP.NET 2.0? I have a dropdownlist (ddlNav) on my web form. On the page_load I do this: ddlNav.BorderStyle = BorderStyle.Solid...
1
by: phpfreak2007 | last post by:
Hi all.. I am displaying a form from thread. I set its startposition property to centreparent but its displayed on topleft corner.. I am displaying form using... error_msg.ShowDialog();...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
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,...
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...

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.