Computing.Net > Forums > Windows XP > Visual Basic

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Visual Basic

Reply to Message Icon

Name: jackets380
Date: May 18, 2004 at 09:06:59 Pacific
OS: 98se
CPU/Ram: 1.8 512
Comment:

I am trying to make a project. In this project i have several text boxes. What I want my program to do is to add up all of the numbers from the text box and if the number is higher than 30 I want it to say "HI" and if it is less than 30 i want it to say "BYE" and if it is 30 i want to say "HELLO". I have declared the variables and boolean, i know how to use the val function. Now I need to figure out how it will only say HI, instead of saying BYE, then HI. Any help - give me a shout



Sponsored Link
Ads by Google

Response Number 1
Name: Martyn999
Date: May 18, 2004 at 09:28:29 Pacific
Reply:

simplest way is to make your text boxes ina control array. name the array something like "txtnums", then use this code to loop through and add all the values up.

Dim Count As Integer
For Count = LBound(txtnums) To UBound(txtnums)
Number = Number + txtnums(Count).Text
Next Count

If Number > 30 Then MsgBox "HI"
If Number < 30 Then MsgBox "BYE
If Number = 30 Then MsgBox "HELLO"

you can change the msgboxes to whatever you want, maybe displayed in a label. also change the variable names if you want.


0

Response Number 2
Name: jackets380
Date: May 18, 2004 at 14:13:02 Pacific
Reply:

HOLY CRAP THANKS ~ it's been a while since i've used VB. Thanks so much


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: Visual Basic

How to install Visual Basic www.computing.net/answers/windows-xp/how-to-install-visual-basic/78832.html

visual basic how to view www.computing.net/answers/windows-xp/visual-basic-how-to-view/121965.html

Visual Basic .NET 2003 Itl. Problem www.computing.net/answers/windows-xp/visual-basic-net-2003-itl-problem/83384.html