Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 607
  • Last Modified:

c# create dialog box

Hi,
How can I choose dialogbox from toolbox?

Thanks,
JT
0
jtran007
Asked:
jtran007
  • 3
  • 2
  • 2
  • +1
3 Solutions
 
Carl TawnSystems and Integration DeveloperCommented:
Which dialog box? Open, Save, Color, Folder and Font dialogs should all be available in the toolbox under the "Dialogs" heading.
0
 
jtran007Author Commented:
Hi,

Customized dialog which just have label and one button.

Thannks,
JT
0
 
Carl TawnSystems and Integration DeveloperCommented:
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
anarki_jimbelCommented:
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
 
anarki_jimbelCommented:
Just two examples (both show OK button:

            MessageBox.Show("Hello");
            MessageBox.Show("Hello","My Dialog Caption", MessageBoxButtons.OK);
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
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
 
anarki_jimbelCommented:
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
 
AndyAinscowFreelance programmer / ConsultantCommented:
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
 
jtran007Author Commented:
Thanks,
JT
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now