| | |
Need to convert from string to integer
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2009
Posts: 32
Reputation:
Solved Threads: 0
How would I ask the user to input what type of engine they want and getting an output of $150
vb.net Syntax (Toggle Plain Text)
Console.WriteLine("Enter EngineChoice for your vehicle:") Response = Console.ReadLine() EngineChoice = Convert.ToString(Response) If EngineChoice = Sixcylinder Then Convert.ToInt32(Response) Console.WriteLine(150) ElseIf EngineChoice = Eightcylinder Then Console.WriteLine(475) ElseIf EngineChoice = Diesel Then Console.WriteLine(750)
•
•
Join Date: Sep 2009
Posts: 286
Reputation:
Solved Threads: 37
0
#2 22 Days Ago
This is a console app or is that just for your example? If a console app, I would start by displaying a list of the choices they have to pick from with an item/row number starting each line and then asking for them to type that item/row number in for the input. Also remember what is read/written is already text even if there writing a number...
VB Syntax (Toggle Plain Text)
Dim strEngineChoice As String = "" Console.WriteLine("Enter 1 for six cylinder") Console.WriteLine("Enter 2 for eight cylinder") Console.WriteLine("Enter 3 for disel") strEngineChoice = Console.ReadLine Select Case strEngineChoice Case "1" Console.WriteLine("Price : $150") Case "2" Console.WriteLine("Price : $475") Case "3" Console.WriteLine("Price : $750") Case Else Console.WriteLine("Invalid selection") End Select
Last edited by TomW; 22 Days Ago at 2:38 pm.
![]() |
Similar Threads
- how to compare a string to an integer in java (Java)
- String/Integer C++ Question (C++)
- c++ very basic, convert a string to an integer (C++)
- Need help to convert a string to an integer (C)
- how to convert a string to integer (HTML and CSS)
- how to convert string array in integer array (C)
- to convert string to integer value (Legacy and Other Languages)
- Convert a string to an integer (PHP)
- Converting String to Integer help (C++)
- String to integer to ascii (C)
Other Threads in the VB.NET Forum
- Previous Thread: Keeping spaces when extracting text from HTML
- Next Thread: How to select a value in the database
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array basic beginner bing browser button buttons center check code crystalreport cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic dropdownlist excel fade file-dialog filter forms ftp generatetags google hardcopy html images input insert intel internet mobile monitor net networking objects open output panel passingparameters pdf picturebox picturebox1 port position print printing problem save searchbox searchvb.net select serial settings shutdown soap sqlserver survey table tcp temperature text textbox timer timespan toolbox transparency trim update user vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode year





