Solved

How Do You Create a Popup Window in C#?

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

Thanks,

Dan
0
Comment
Question by:danielolorenz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 90 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 90 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 195 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 215 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Input parameteres to DragOver 2 58
Amazon S3 .Net error 5 79
parse string in c# 5 41
How to input barcode scanner data into textbox in C#  ? 13 70
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

752 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