Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

vb.net or c#, InputBox to get user value ("abc", "123", etc.

Posted on 2014-10-09
4
722 Views
Last Modified: 2014-10-24
I found some sample code for inputbox but they mainly relate to inputs in form of what button a user clicks.

Question: How can I code to get user input by prompting the user a text box to enter her/his choice like "ABC", "123", etc?

Are there such control or I have to use another form using Friend scope instead?
0
Comment
Question by:Mike Eghtebas
4 Comments
 
LVL 22

Expert Comment

by:Mrunal
ID: 40370782
have you used "InputBox Function" ?

here is reference:

http://msdn.microsoft.com/en-us/library/6z0ak68w%28v=vs.90%29.aspx
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 40371317
re:  have you used "InputBox Function" ?

Yes I have. That is why I started my question saying: "I found some sample code for inputbox but they mainly relate to inputs in form of what button a user clicks."
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 300 total points
ID: 40372238
Are you in C# or in VB.

The InputBox function is not a Framework function. It exists only in the Microsoft.Visual.Basic namespace to mimick the same function as it existed in VB6. So it is available only in VB. What it does is exactly what you want: present a TextBox to the user for some input, and return you the value.

There is no equivalent in C#, where you need to design your own form to do something similar, but it is a gain since you can do anything in it. If you have seen something about InputBox in C#, it is simply somebody who designed a form and gave it that name. If you create you own, you will not be limited in anyway with what it can do.
0
 
LVL 11

Assisted Solution

by:louisfr
louisfr earned 200 total points
ID: 40372961
Any Function available to VB is available to C#.
If you want to use the Microsoft.VisualBasic.Interaction.InputBox method, you only need to add Microsoft.VisualBasic.dll to the references of your project.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question