http://www.visual-basic-tutorials.com/
It often happens that you need to prompt the user to enter an expected value.
VB.NET Console Application:
It often happens that you need to prompt the user to enter an expected value.
VB.NET Console Application:
Dim
nl
As
String
= Environment.NewLine
' say hi and ask them for a name
Console.WriteLine(
"Hello there. What's your name?"
+ nl)
Dim
input = Console.ReadLine()
' say something to the user
Console.WriteLine(nl &
"Nice to meet you "
& input &
"."
& nl)
Console.Read()
VB>NET Windows Form Application
Dim
prompt
As
String
=
String
.Empty
Dim
title
As
String
=
String
.Empty
Dim
defaultResponse
As
String
=
String
.Empty
Dim
answer
As
Object
' Set prompt.
prompt =
"Hello there. What's your name?"
' Set title.
title =
"Getting user input"
' Set default value.
defaultResponse =
"Your name here"
' Display prompt, title, and default value.
answer = InputBox(prompt, title, defaultResponse)
' Say something to the user
Messagebox.Show(
"Nice to meet you "
& answer)
No comments:
Post a Comment