Input Box in C#

  • Thread starter Thread starter Abhishek
  • Start date Start date
A

Abhishek

Hi!
I want to prompt the user an inoput box and get the result in a variable
I know how to do this in VB but how do i do it in c#.

Regards,
Abhishek
 
There's no InputBox API in C#. You can create a new form with a TextBox in
it and use ShowDialog() API to show it.

-vJ
 
Abhishek,

There is no problem to set a reference in C# to the Microsoft.VisualBasic
namespace in the same way as any other namespace.

You can than use C# with the members from that Microsoft.VisualBasic
namespace.

If you want that is up to you, I would do that only in rare places where I
have not a better alternative.

I hope this gives an idea.

Cor
 
Thanks folks
But it just seams strange on part of MS not to include it in C#
anyways i know the workarounds but just wanted to know if there is InputBox
in c#
Thanks again

abhishek
 
Well, one team in Microsoft wrote the .Net Framework, include everything
they though it needed.

Then another team at MS was charged with taking that, and using it to
simulate the VB6 experience as best they could in VB.Net. So, VB has a
collection of methods not automatically included in other languages.
 
This seems to be the kind of thing I would expect to be different in
c# vs. vb.net. VB has the tradition of being easier for a
non-programmer to work with. Therefore, prewritten input boxes are a
good thing for vb. I guess the folks at ms figured c# developers would
usually want more control over the presentation and function. What I
do not understand is compiler/editor (studio) differences. VB seems to
be better at picking up errors before compile time, yet does not have
an unreachable code warning. Those things seem language independent.
I would like to see base visual studio behavior be a little more
consistent

-Dan
 
Back
Top