Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Messagebox with input field [duplicate]

Tags:

c#

.net

Is it possible to show (pop-up) a message box with an input field in it, possibly a text box? Is somewhere in the language or the framework?

like image 374
Sunscreen Avatar asked May 29 '12 10:05

Sunscreen


People also ask

What is MessageBox class explain MessageBox () in detail?

A message box is a prefabricated modal dialog box that displays a text message to a user. You show a message box by calling the static Show method of the MessageBox class. The text message that is displayed is the string argument that you pass to Show.

What is the 3nd 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.

What is the difference between MsgBox and InputBox in VB?

VBA InputBox is used to prompt the user to enter the values. This message box is used to displaying a message and waits for the user action performed by pressing the button. A text can be return in the text box by using the InputBox function if the user clicks on the OK or Enter button.

What is MessageBox show in C#?

Displays a message box in front of the specified object and with the specified text, caption, buttons, icon, and default button. Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon) Displays a message box in front of the specified object and with the specified text, caption, buttons, and icon.


1 Answers

You can reference Microsoft.VisualBasic.dll.

Then using the code below.

Microsoft.VisualBasic.Interaction.InputBox("Question?","Title","Default Text"); 

Alternatively, by adding a using directive allowing for a shorter syntax in your code (which I'd personally prefer).

using Microsoft.VisualBasic; ... Interaction.InputBox("Question?","Title","Default Text"); 

Or you can do what Pranay Rana suggests, that's what I would've done too...

like image 134
animaonline Avatar answered Oct 15 '22 21:10

animaonline