Solved

MessageBox like Popup with label?

Posted on 2006-07-08
5
249 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
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…

860 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