InputBox

G

Guest

Hello
Is there a standard inputbox in the .Net framework (usable for C#), just like a modal MessageBox except it prompts for a string? I know that VB had an InputBox( ) method, but I don't see an equivalent, nor do I see how to modify the MessageBox to make it an InputBox. The ideal would be something like

string strResult = InputBox("Message here")
//strResult set to whatever the user typed

I could always just write my own inputbox form, but that's a lot of extra work for something that should be basic

Thanks
Mike
 
M

Marc Butenko

Add a reference to the Microsoft Visual Basic .NET Runtime and then the
following code will work:

string s = Microsoft.VisualBasic.Interaction.InputBox("x","y","z",0,0);

Microsoft.VisualBasic.Interaction.MsgBox(s,Microsoft.VisualBasic.MsgBoxStyle
..OKCancel,"Test");


--
Marc Butenko
(e-mail address removed)



Mike said:
Hello,
Is there a standard inputbox in the .Net framework (usable for C#), just
like a modal MessageBox except it prompts for a string? I know that VB had
an InputBox( ) method, but I don't see an equivalent, nor do I see how to
modify the MessageBox to make it an InputBox. The ideal would be something
like:
string strResult = InputBox("Message here");
//strResult set to whatever the user typed.

I could always just write my own inputbox form, but that's a lot of extra
work for something that should be basic.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

A Sub in another Sub... 3
InputBox dialog 5
InputBox for C#??? 2
InputBox 3
Calculate value based on a cell and inputbox 2
keypress with inputbox 1
InputBox and Password 1
VBA in module vs slide 4

Top