473,796 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
("frmInstructio ns") 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 "frmInstruction s.ActiveForm.Sh ow", but neither are
working. Can anyone tell me what I'm doing wrong?

Thanks in advance!
--
Sherwood
Jul 21 '05 #1
1 1183
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.ShowDialo g(); // if its a dialog box

or

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

Alex

"Sherwood" <Sh******@discu ssions.microsof t.com> wrote in message
news:0B******** *************** ***********@mic rosoft.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
("frmInstructio ns") 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 "frmInstruction s.ActiveForm.Sh ow", 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
2674
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 CSS and validate. I'm not introducing full CSS-P at this stage, but where I can I'm trying make inprovements. The page uses a 3 frame layout. The left frame contains a form with a textbox and a number of buttons (<input type="button">).
1
974
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
1537
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 need them displayed on the post page. Any help would be greatly appreciated!
1
1390
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 when it is valid, the second ASP page redirects and displays the results on a third ASP page. Can you please show me the code and an example? Please help. Thanks. Spad.
2
3328
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 generate some fields according the data I will select from the drop down list so basically I have drop down list which will ask for the number of students information I want to enter and after selecting a value from the number of students drop down it...
1
2011
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 the user entered in the form on the confirmation page? Thanks.
2
2463
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) display on the second monitor. The form that I create and design within the development environment will only display on the primary monitor. I understand that I need to set the bounds of the form to the bounds of the secondary display, but the form...
1
2430
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 data entered by the user on the confirmation page. Could someone shed any light on how to link the pages and do this. All I can find out about is displaying information that is inserted into a database which is not relevant. This is the code to...
0
851
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 ddlNav.BorderColor = Drawing.Color.Black ddlNav.BackColor = Drawing.Color.WhiteSmoke ddlNav.ForeColor = Drawing.Color.Navy The ForeColor and BackColor work, but anything having to do with the Border
1
1031
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(); //where error_msg is object of form Please help me to solve this problem..
0
10449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9047
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
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 we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.