Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How Do You Create a Popup Window in C#?

Posted on 2011-09-13
11
Medium Priority
?
400 Views
Last Modified: 2012-05-12
How do you create a popup window in C#?

Thanks,

Dan
0
Comment
Question by:danielolorenz
11 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 36531028
WinForms or WebForms?

Can you elaborate more on what you consider a "popup" window to be and/or contain?
0
 
LVL 45

Assisted Solution

by:AndyAinscow
AndyAinscow earned 360 total points
ID: 36531051
The following would display a custom windows form (called myform) as a modeless window.
myform.Show();

Is that what you wanted ?
0
 

Author Comment

by:danielolorenz
ID: 36531107
a myform would be perfect.

How do you import?  It does not recognize it.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:danielolorenz
ID: 36531109
I could also use WinForms if you show me how to use it.
0
 

Author Comment

by:danielolorenz
ID: 36531132
This is a small popup for a web application
0
 
LVL 45

Assisted Solution

by:AndyAinscow
AndyAinscow earned 360 total points
ID: 36531143
OK, I'll repeat my comment with a small change

The following would display a custom windows form (called YourCustomFormNameGoesHere) as a modeless window.
YourCustomFormNameGoesHere.Show();

Is that what you wanted ?



YourCustomFormClassNameGoesHere YourCustomFormNameGoesHere = new YourCustomFormClassNameGoesHere();
YourCustomFormNameGoesHere.Show();

Open in new window

0
 

Author Comment

by:danielolorenz
ID: 36531169
Yes, this is what I want.  It is for a web application.  How do you code this from scratch?
0
 

Author Comment

by:danielolorenz
ID: 36531170
I am getting an error
0
 
LVL 9

Assisted Solution

by:BlueYonder
BlueYonder earned 780 total points
ID: 36532126
Ajax may be your best option.  Download ajax from http://www.asp.net/ajaxlibrary/download.ashx.  Follow the tutorial for the modal popup.  http://www.asp.net/ajaxlibrary/act_ModalPopup.ashx.  Add <%@ Register Assembly="AjaxControlToolKit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> above all content tags, but below the page.  Add a script manager to the page, it is in the ajax tools and add it into the maincontent part of the page.  it looks like    
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePartialRendering="true">
    </asp:ToolkitScriptManager>
0
 
LVL 12

Accepted Solution

by:
starlite551 earned 860 total points
ID: 36532464
OK I have the perfect solution for you.. All you need to do is follow a few simple steps and you get windows forms Message Box Control or Form class itself accessible in the Web Application. So here are the steps :
1. Go to Solution Explorer Right Click on The Project and Click on Add References.
2. An Add Reference Dialog Box Will Appear.
3. In The .NET Components Section Browse Down Till You See System.Windows.Forms Namespace Reference.Select that by clicking the checkbox next to it and click on OK.
4. After you have done so. Go to the Code Section of your .aspx.cs Page. At the top of the code file in the namespace references using statements list add the following line :
 
using System.Windows.Forms;

Open in new window

5. Now you can call classes that reside within this namespace directly in your Web Application.
6. For Example you can then use the following code in a button click event :
protected void Button1_Click(Object sender,EventArgs e)
{
      MessageBox.Show("You Clicked "+Button1.ClientId.ToString()); 
}

Open in new window

0
 

Author Closing Comment

by:danielolorenz
ID: 36536529
That was great help.  Your solutions were very good.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question