C
C#•16mo ago
bellic

Input Box in C#

Hi. I would like to know how to get an input box in C# please
51 Replies
TheRanger
TheRanger•16mo ago
in what, webforms? winforms? wpf? asp.net ? razor ? blazor ? avalonia?
bellic
bellicOP•16mo ago
Winforms
TheRanger
TheRanger•16mo ago
did you create the input box first? $details
MODiX
MODiX•16mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, what you expect the result to be, what .NET version you are using and what platform/environment (if any) are relevant to your question. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
bellic
bellicOP•16mo ago
No I want to get it from VB
TheRanger
TheRanger•16mo ago
VB? do u mean the designer mode?
bellic
bellicOP•16mo ago
I said
using Microsoft.VisualBasic
using Microsoft.VisualBasic
But Interaction does not pop up as an option No I want to get an InputBox through code
TheRanger
TheRanger•16mo ago
winforms itself has an InputBox
bellic
bellicOP•16mo ago
Really wacky question, have you used a language called Delphi before?
TheRanger
TheRanger•16mo ago
no, but what does this have to do with winforms?
bellic
bellicOP•16mo ago
How do I get it? See C# and Delphi are very similar
TheRanger
TheRanger•16mo ago
do you want to create it programatically or through designer mode?
bellic
bellicOP•16mo ago
Through program code Not designer
TheRanger
TheRanger•16mo ago
bellic
bellicOP•16mo ago
And through designer?
TheRanger
TheRanger•16mo ago
no, link only shows how to create one programatically
Insire
Insire•16mo ago
Visual basic has a dialog window, that holds a single textbox, which is called inputbox. i believe they want to use that and not write their own
bellic
bellicOP•16mo ago
You see Delphi was just simple
userinput := inputbox('Hello', 'World', '');
userinput := inputbox('Hello', 'World', '');
Window title, Prompt, Input
Insire
Insire•16mo ago
here is how to get access to that https://stackoverflow.com/a/97156
Stack Overflow
What is the C# version of VB.NET's InputBox?
What is the C# version of VB.NET's InputBox?
bellic
bellicOP•16mo ago
Been trying to do that It does not work
bellic
bellicOP•16mo ago
No description
Insire
Insire•16mo ago
you'll have to be more specific than that. what does work?
bellic
bellicOP•16mo ago
Interaction.InputBox does not work Importing VB does
Insire
Insire•16mo ago
how does it not work? do you get an error? what error do you get?
bellic
bellicOP•16mo ago
No description
bellic
bellicOP•16mo ago
Does not appear in IntelliSense
Insire
Insire•16mo ago
works over here
No description
Insire
Insire•16mo ago
and also runs
No description
Insire
Insire•16mo ago
what .NET version are you using?
bellic
bellicOP•16mo ago
How do I check? I just installed it last night So should be latest version?
Insire
Insire•16mo ago
installed what? Visual Studio?
bellic
bellicOP•16mo ago
Yes
Insire
Insire•16mo ago
Visual Studio is an IDE, it comes with different .NET Versions, based on which release you download install. right now, you get .NET 8 i didnt use .NET 8 for the sample i showed, but .NET Framework 4.7.1
bellic
bellicOP•16mo ago
I think mine is 4.7.2 iirc
Insire
Insire•16mo ago
which comes with windows 10 and 11 by default did you add the assembly reference to Microsoft.VisualBasic like the SO link described?
bellic
bellicOP•16mo ago
Yes Look in my screenshot It is there
Insire
Insire•16mo ago
none of your screenshots show assembly references. they show some using statements among your code
bellic
bellicOP•16mo ago
using Microsoft.VisualBasic;
using Microsoft.VisualBasic;
Insire
Insire•16mo ago
this is where you can see assembly references
No description
Insire
Insire•16mo ago
thats a using statement
bellic
bellicOP•16mo ago
No description
Insire
Insire•16mo ago
and this is how you check your .NET version for your project
No description
bellic
bellicOP•16mo ago
Does not look like it is there
Insire
Insire•16mo ago
yes, so you need to add it
bellic
bellicOP•16mo ago
How?
Insire
Insire•16mo ago
check my SO link
bellic
bellicOP•16mo ago
Thank you Is it bad to copy someone else's input box design? 😂
Insire
Insire•16mo ago
its kinda bad to use inputbox and winforms
bellic
bellicOP•16mo ago
Where can I find some good ones?
Insire
Insire•16mo ago
and VB good what? what are you trying to do? if you are trying to build a desktop application for windows, then i recommend using WPF
bellic
bellicOP•16mo ago
I'm just playing around

Did you find this page helpful?