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?
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.
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.
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.
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.
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With