In: Computer Science
In VB console write a Console Application that reads an input value for ??. You can assume that the user only inputs numeric values.
Compile & Execute Visual Basic Program
Now, The new project appears in Solution Explorer.
Reads value from the user in Visual Basic Console App
Imports System 'Include the system namespace in our program.'
Module Program 'Module of a class that contains the data and
procedures.'
Dim num1 As Integer 'Dim statement is used for variable declaration
and storage allocation for one or more variables.'
Sub Main() 'Indicates the entry point'
num1 = Console.ReadLine() 'ReadLine for accepting input from the
user and store it into a variable(num1).'
End Sub
End Module
Display input from to user in Visual Basic Console App
Imports System
Module Program
Dim num1 As Integer
Sub Main()
num1 = Console.ReadLine()
Console.WriteLine(num1) 'WriteLine is used to output the stream'
End Sub
End Module
* Dim num1 As Integer it only takes an Integer value as a input, If we try to pass an string it through an error => Conversion from string "String" to type 'Integer' is not valid.