Which control to use for quick text input (inputbox)?
Asked Answered
S

2

5

I need a quick text input dialog box (MessageBox with a single text box in it). Is there any control available or should I use a form?

I just want user to enter some ID. And in other occasion I want 2 texboxes for username and password.

Subassembly answered 29/10, 2009 at 13:55 Comment(1)
It always baffled why there has never been one build into the .NET Framework.Ecumenicism
T
8

Microsoft.VisualBasic.dll has an InputBox method which you can use from C# to get a single string.

For example (Add a reference to Microsoft.VisualBasic.dll first)

using Microsoft.VisualBasic;

string response = Interaction.InputBox("Enter a string:", "MyApp", "DefaultString", 0, 0);

Othewise, you'll have to make your own form.

Tubuliflorous answered 29/10, 2009 at 13:59 Comment(3)
Is there anyway to make the InputBox use a "*" input mask so it can be used as a password form?Soapberry
@AdamJakiela: No; you need to create your own form.Tubuliflorous
It is also necessary to add a reference to Microsoft.VisualBasic.Rittenhouse
A
0

simple one is inputbox

Autodidact answered 29/10, 2009 at 13:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.