The Console class in the System namespace provides a function
ReadLine for accepting input from the user and store it into a variable. For example,
Dim message As String
message = Console.ReadLine
The following example demonstrates it:
Module variablesNdataypes
Sub Main()
Dim message As String
Console.Write("Enter message: ")
message = Console.ReadLine
Console.WriteLine()
Console.WriteLine("Your Message: {0}", message)
Console.ReadLine()
End Sub
End Module
When the above code is compiled and executed, it produces the following result (assume the user inputs Hello World):
Enter message: Hello World
Your Message: Hello World
No comments:
Post a Comment