Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to display textBox control in MessageBox?

Tags:

c#

.net

winforms

Any idea how to display textBox control in MessageBox.

I'm working on winforms projcet c#.

Thank you in advance.

like image 717
Michael Avatar asked May 29 '13 10:05

Michael


People also ask

What method do you call to display a message box?

Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, String) Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and Help keyword.

What is the 3rd parameter in MessageBox show ()?

The first parameter msg is the string displayed in the dialog box as the message. The second and third parameters are optional and respectively designate the type of buttons and the title displayed in the dialog box. MsgBox Function returns a value indicating which button the user has chosen.

How do I view MessageBox?

To display a message box, call the static method MessageBox. Show. The title, message, buttons, and icons displayed in the message box are determined by parameters that you pass to this method.

What is message box control?

The MessageBoxAdv is an advanced MessageBox control that can be used to display a message to the end-user. It provides icons, buttons support and complete customization option for the control.


2 Answers

You can't. MessageBox is a special container designed to only show a message and buttons. Instead, you can create your own Form with whatever controls you want, and use .ShowDialog() on it.

like image 147
krillgar Avatar answered Sep 26 '22 01:09

krillgar


You can simply add an Input box from VB.NET into your C# project. First add Microsoft.VisualBasic to your project References, then use the following code:

string UserAnswer = Microsoft.VisualBasic.Interaction.InputBox("Your Message ", "Title", "Default Response");

And that should work properly.

like image 31
Erfan Avatar answered Sep 22 '22 01:09

Erfan