Loops Question

H

Howard

Ok, I'm back. I have another question (probably an easy one, even to
non-experts). I was inspired to expand this little program (thanks to
all of your help). If I was using the following code to create a game
that prompts the user to guess a number from 1-100, and wanted to have
the console write a message Console.WriteLine("Invalid Entry") when the

user types in character(s) that are non-numerical - What would the
syntax be for this? Here's the code (which works great) but without
that new part.


Module Module1


Sub Main()
Const Value As Integer = 27
Dim Number As Integer


Console.WriteLine("Pick a number from 1 to 100")
Number = Integer.Parse(Console.ReadLine())


While Number <> Value
If Number < Value Then
Console.WriteLine("Higher")
Else
Console.WriteLine("Lower")
End If
Number = Integer.Parse(Console.ReadLine())
End While


Console.WriteLine("Correct!")
End Sub


End Module


Thank you,
Howard
 
K

Ken Halter

Howard said:
Ok, I'm back. I have another question (probably an easy one, even to

You know..... since this question shows in >=2 groups here and >=2 groups in
the VB Classic groups, I have to assume that you've never heard of
crossposting. There's never a reason to post a single question to multiple
groups, one at a time. It's a waste of time for you and a waste of time for
the people trying to help.

Learn to Crosspost. It's very easy. It's exactly like sending an email to
more than one person. A HUGE benefit is that A) you don't have to search all
groups in the list for answers to your question. Just check any of the
groups in your crosspost list. B) The people answering the questions won't
be wasting their time answering a question that has a stack of 20 or so in
another group. This is because, when you crosspost instead of multipost (as
you're doing now), all answers, no matter which group in your list they
originated from, will be connected and shown in a single thread, regardless
of which group in the list you (or the people answering) happens to be
looking at at the time. Crossposting saves time for everyone involved.
Multiposting wastes time for everyone involved. Since no one's getting paid
to post or answer questions here, choose the method that wastes the least
amount of time, for everyones sake.
 
J

Jon Skeet [C# MVP]

Ken Halter said:
You know..... since this question shows in >=2 groups here and >=2 groups in
the VB Classic groups, I have to assume that you've never heard of
crossposting. There's never a reason to post a single question to multiple
groups, one at a time. It's a waste of time for you and a waste of time for
the people trying to help.

Learn to Crosspost. It's very easy. It's exactly like sending an email to
more than one person. A HUGE benefit is that A) you don't have to search all
groups in the list for answers to your question. Just check any of the
groups in your crosspost list. B) The people answering the questions won't
be wasting their time answering a question that has a stack of 20 or so in
another group. This is because, when you crosspost instead of multipost (as
you're doing now), all answers, no matter which group in your list they
originated from, will be connected and shown in a single thread, regardless
of which group in the list you (or the people answering) happens to be
looking at at the time. Crossposting saves time for everyone involved.
Multiposting wastes time for everyone involved. Since no one's getting paid
to post or answer questions here, choose the method that wastes the least
amount of time, for everyones sake.

While cross-posting is certainly better than multi-posting, I'd
encourage learning to work out the *single* best group to ask a
question in, and sticking to that one at least until it's clear that
no-one in that group knows the answer.
 
H

Howard

Thanks Ken,
You were correct in your thinking - I was not aware of the crossposting
feature (I'm new to not only to Visual Basic, but also to user groups in
general). I'll keep that in mind for the future. I also apologize if I
wasted your time.

Thank you,
Howard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top