473,608 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loops Question

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.WriteLi ne("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.WriteLi ne("Pick a number from 1 to 100")
Number = Integer.Parse(C onsole.ReadLine ())
While Number <> Value
If Number < Value Then
Console.WriteLi ne("Higher")
Else
Console.WriteLi ne("Lower")
End If
Number = Integer.Parse(C onsole.ReadLine ())
End While
Console.WriteLi ne("Correct!")
End Sub
End Module
Thank you,
Howard

Dec 21 '05 #1
3 1053
"Howard" <ho**********@g mail.com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
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.

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Dec 21 '05 #2
Ken Halter <Ken_Halter@Use _Sparingly_Hotm ail.com> wrote:
"Howard" <ho**********@g mail.com> wrote in message
news:11******** *************@o 13g2000cwo.goog legroups.com...
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.


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.

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 21 '05 #3
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

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Dec 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
6571
by: JustSomeGuy | last post by:
I have a need to make an applicaiton that uses a variable number of nested for loops. for now I'm using a fixed number: for (z=0; z < Z; ++z) for (y=0; y < Y; ++y) for (x=0; x < X; ++x)
4
2127
by: Dr. David Kirkby | last post by:
I have a program that loops through and changes all the elements on an array n times, so my code looks like this: for (n=1; n < n_max; ++n) for(i=imax; i >= 0; --i) { for(j=0 ; j < jmax; ++j) { /* main bulk of code goes here */ } }
46
9902
by: Neptune | last post by:
Hello. I am working my way through Zhang's "Teach yourself C in 24 hrs (2e)" (Sam's series), and for nested loops, he writes (p116) "It's often necessary to create a loop even when you are already in a loop." Then he goes on to portray a contrived example that doesn't tell me under what conditions a nested loop might be favoured as a solution? i.e. what are nested loops useful for? What kinds of algorithms are served by nested loops?...
6
1704
by: Scott Brady Drummonds | last post by:
Hi, everyone, I was in a code review a couple of days ago and noticed one of my coworkers never used for() loops. Instead, he would use while() loops such as the following: i = 0; while (i < n) { ...
17
3042
by: John Salerno | last post by:
I'm reading Text Processing in Python right now and I came across a comment that is helping me to see for loops in a new light. I think because I'm used to the C-style for loop where you create a counter within the loop declaration, for loops have always seemed to me to be about doing something a certain number of times, and not about iterating over an object. The reason for this distinction comes from the fact that I read a lot how...
0
8067
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8010
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8501
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6820
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6015
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3967
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2477
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.