Solved

MessageBox like Popup with label?

Posted on 2006-07-08
5
234 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
  • 2
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
CaldNT earned 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

910 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now