Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have need to produce an Input Box for a C# program, in the past I have used the VB.NET input box when I needed one but have lost or can't find an example I believe Griff answered it. I found a suitable C# widget via the article Input Box in C# for WindowsForms[^] However this uses VS2010 which I am not using for this project as it needs to .NET2 (will run on Windows 2000! and up).
So which is the way you guys would do it? And also would you mind reminding me of the way to get VB into C#(!)
Glenn

What I have tried:

Looked through the ashes of previous projects, Prayer, Google!
Posted
Updated 8-Mar-16 3:48am
Comments
CHill60 8-Mar-16 9:41am    
"as it needs to .NET2" ? Do you mean you want to target .net2 or the article targets .net2 ?
I only ask because I can build for .net2 from both VS2013 and VS2010 and I know .net2 runs on Win2000 so I'm not sure what your problem is
glennPattonWork3 8-Mar-16 9:56am    
Also likening issues the firm don't want to (or can't) cough up for a later copy of Vis Studio so I am using an aged copy of 2005 which I have.
CHill60 8-Mar-16 10:08am    
Express versions are free! (And can apparently be used for commercial purposes)
glennPattonWork3 8-Mar-16 10:14am    
Mmm, worth a thought!

C#
string input = Microsoft.VisualBasic.Interaction.InputBox("Title", "Prompt", "Default", 0, 0);  

Right Thanks Stack OverFlow! The first rule of quick answers is don't ask! Many times I have asked a question and gone off on a different tangent!:-)
 
Share this answer
 
v2
Other solution on StackOverflow - What is the C# version of VB.net's InputDialog? - Stack Overflow[^]
Most of the answers suggest
C#
using Microsoft.VisualBasic;
but I just can't bring myself to do that. One of the solutions on that post gives a very simple dialog box example on which you could place any type of control
 
Share this answer
 
Comments
glennPattonWork3 8-Mar-16 9:54am    
using Microsoft.VisualBasic; does bring chills!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900