Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MessageBox like Popup with label?

Posted on 2006-07-08
5
Medium Priority
?
273 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

Technology Partners: 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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

618 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