Solved

c# create dialog box

Posted on 2011-02-28
9
600 Views
Last Modified: 2013-12-17
Hi,
How can I choose dialogbox from toolbox?

Thanks,
JT
0
Comment
Question by:jtran007
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 35001402
Which dialog box? Open, Save, Color, Folder and Font dialogs should all be available in the toolbox under the "Dialogs" heading.
0
 

Author Comment

by:jtran007
ID: 35001491
Hi,

Customized dialog which just have label and one button.

Thannks,
JT
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 50 total points
ID: 35001685
There is not preset dialogbox, you have to create your own. Theres a quick guide to creating your own dialog box here:

    http://msdn.microsoft.com/en-us/library/bb383855(v=vs.90).aspx
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 29

Expert Comment

by:anarki_jimbel
ID: 35001745
If you are talking about MessageBox - you don't need to select it from the toolbox.  You just write in your code:

MessageBox.Show("your message", other options)

There is number of overloads for the static Show method. You may indicate buttons, icins, default button etc.

See:
http://msdn.microsoft.com/en-us/library/system.windows.forms.messagebox.show(v=VS.80).aspx
0
 
LVL 29

Expert Comment

by:anarki_jimbel
ID: 35001796
Just two examples (both show OK button:

            MessageBox.Show("Hello");
            MessageBox.Show("Hello","My Dialog Caption", MessageBoxButtons.OK);
0
 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 100 total points
ID: 35001991
A dialogbox is just a form which is displayed modally.

MyForm frm = new MyForm();
frm.ShowDialog();   //Code halts here until the form is shown


OR
MyForm frm; //NOT local in the function
....
frm = new MyForm();
frm.Show();  //Code continues after here, even when form is shown
0
 
LVL 29

Accepted Solution

by:
anarki_jimbel earned 100 total points
ID: 35003557
Just to clarify what AndyAinscow just told:

You may create your own dialog - just by creating a new form with a label and a button, as you wanted above.

To show the dialog you just call myCustomDialogForm.ShowDialog()

But! ShowDialog does not accept any results. It means you need to provide some custom code to set text on the label on the form. E.g., you may have a method like:

myCustomDialogForm.SetDialogMessage(string text){}


The you just call:

myCustomDialogForm.SetDialogMessage("Hello");
myCustomDialogForm.ShowDialog();
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 35004468
Just seen a typo in my earlier comment
//Code halts here until the form is shown
should be
//Code halts here until the form is closed
0
 

Author Closing Comment

by:jtran007
ID: 35014511
Thanks,
JT
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
MVC DDL Json Not Binding to Model 2 27
Powershell File Sort 8 41
Formula for calculating ROI on training 6 51
Vb.net threads keep increasing 2 37
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
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…

828 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