L
Legless
Be spontaneous, be kind, be open-minded.
I am working on this huge project in college that is an ATM machine and well I don't know how to validate text. I have, for example, a user input that is read to the console and it's an integer but if a user enters a string then the console application breaks. How can I get an error message to come up to say that the string is invalid without the project crashing?
I know Console.WriteLine("Please enter only numeric characters!") for example, as the error message itself but I don't know anything else to do with text validation.
Here, below, is a snippet of my code; it's a simple menu system but the problem lies in here also:
I'm aware that there's probably easier methods of aligning text and such but I like to use my own ways, and we haven't been taught that yet; except for VbTab etc..
Thank you in advance.
I know Console.WriteLine("Please enter only numeric characters!") for example, as the error message itself but I don't know anything else to do with text validation.
Here, below, is a snippet of my code; it's a simple menu system but the problem lies in here also:
Code:
Console.WriteLine(CentralAlignment & " Main Menu")
Console.WriteLine(CentralAlignment & " =========")
Console.WriteLine()
Console.WriteLine(CentralAlignment & "1. Account Details")
Console.WriteLine()
Console.WriteLine(CentralAlignment & "2. Withdraw")
Console.WriteLine()
Console.WriteLine(CentralAlignment & "3. Transaction Log")
Console.WriteLine()
Console.WriteLine(CentralAlignment & "4. Current Balance")
Console.WriteLine()
Console.WriteLine(CentralAlignment & "5. Exit")
Console.WriteLine()
Console.Write(CentralAlignment & "Please select your choice: ")
MenuChoice = Console.ReadLine
I'm aware that there's probably easier methods of aligning text and such but I like to use my own ways, and we haven't been taught that yet; except for VbTab etc..
Thank you in advance.