?
Solved

MessageBox like Popup with label?

Posted on 2006-07-08
5
Medium Priority
?
265 Views
Last Modified: 2010-04-16
I found a nice EE article that works fine except I need a Label to appear on the newly created message form.

Link:     http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21752115.html?query=close+messagebox&topics=327

Code:  
            Form popup = new Form();
            popup.Text = "A popup form";
            popup.FormBorderStyle = FormBorderStyle.Sizable;
            popup.Size = new Size(200, 200);
            popup.Show();


Label:   Label label1 = new System.Windows.Forms.Label();
            label1.AutoSize = true;
            label1.Location = new System.Drawing.Point(57, 30);
            label1.Name = "label1";
            label1.Size = new System.Drawing.Size(35, 13);
            label1.TabIndex = 1;
            label1.Text = "label1";
            label1.Show();
0
Comment
Question by:kvnsdr
[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
  • 2
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
CaldNT earned 1000 total points
ID: 17068630
Try this code:


            // First create the form object
            Form popup = new Form();

            //Create the label and set it's properties
            Label label1 = new System.Windows.Forms.Label();
            label1.AutoSize = true;
            label1.Location = new System.Drawing.Point(57, 30);
            label1.Name = "label1";
            label1.Size = new System.Drawing.Size(35, 13);
            label1.TabIndex = 1;
            label1.Text = "label1";

            //Add the label to the form
            popup.Controls.Add(label1);

            //Set the form's properties            
            popup.Text = "A popup form";
            popup.FormBorderStyle = FormBorderStyle.Sizable;
            popup.Size = new Size(200, 200);

            //Show the form
            popup.Show();
0
 
LVL 4

Expert Comment

by:CaldNT
ID: 17068639
You can add any control in the same way.

The code is basically the same that would be generated by the VS IDE for a similar form. But this code is hidden in a Partial class in VS 2005.

Feel free to ask any other questions regarding the code.

Good luck,

Marcos
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17068984
0
 
LVL 1

Author Comment

by:kvnsdr
ID: 17070285
Yes, TheLearnedOne, I did but it's not C# code.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17070294
I am sorry, did you need your hand held?

Bob
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 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