Help with text boxes??

NerdyGurl

Member
Joined
Apr 19, 2007
Messages
7
Location
Auckland, NZ
Programming Experience
Beginner
Hi, I added a class to a console application, but i dont know how to read a value and store it in a variable from a textbox? all i can come up with is Integer.TryParse(textbox1.text,regoNumber) and
Double.TryParse(textbox2.text,hoursParked)???
 
Textbox in a Console application would be rather unusual.. anyway, why doesn't Integer.TryParse do it?
 
There are no textboxes in Console applications. Do this instead:

Dim snum As String, regoNumber, hoursParked As Integer
Console.Write("Enter reg number: ")
snum = Console.ReadLine()
Integer.TryParse(snum, regoNumber)
Console.Write("Enter hours parked: ")
snum = Console.ReadLine()
Double.TryParse(snum, hoursParked)???
Console.WriteLine("Your reg number is " & regoNumber)
Console.WriteLine("Hours parked is " & hours.Parked)
 
Hi, I added a class to a console application, but i dont know how to read a value and store it in a variable from a textbox? all i can come up with is Integer.TryParse(textbox1.text,regoNumber) and
Double.TryParse(textbox2.text,hoursParked)???

Hi NerdyGurl. You cannot use a TextBox control in a Console application as Console Applications are not Windows Forms Applications.

To get user input, just use Console.ReadKey() or Console.ReadLine()

VB.NET:
Dim x As String = Console.Readline()
 
Back
Top