Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Need some general help with VB -_-
Closed Thread
Old 09-24-2006, 09:04 PM   #1 (permalink)
 
True Techie

Join Date: Aug 2006

Posts: 202

iamchel

Default Need some general help with VB -_-

Hey everyone, I think this might be my first thread Ive started:rolleyes:
but anyways I need some basic help with understanding VB

At school we're learning how to use it (dont laugh its confusing to me ) and Im just having some difficulties. I need to make a simple program that takes an unlimited number of numbers and then calculate the average and display it in a label. Heres the basic way its supposed to work: user inputs number in text box (txtinput) then presses the 'enter number' command box (is it a box? button?). Then after they have done that same procedure as many times as they like they press the 'average' button which should then display the average of all the number combined. Now Im just confused where I need to put what code and how to set up my counter. Also how are you supposed to show text - like instructions in a vb program? Ive seen other classmates typing all of the instructions (like a paragraph) in the little caption box. I think its a little silly so I just make the label show on Form load. Is this better?

Thanks a bunch for the help.

EDIT* Im using VB 6.0
__________________
CPU - E6400 Core 2 Duo @ 3.2ghz
Cooling - Zalman CNPS9500
Motherboard - Asus P5W DH Deluxe
Memory - OCZ PC2-8000 Platinum XTC 2GB (2x1024MB)
Video - BFG 8800 GTX OC
DVD - LG Super Multi
HD - WD Raptor 36gb
HD2 - Maxtor Diamondmax 10 250gb
PSU - Corsair HX Series CMPSU-620HX 620W
Case - Cooler Master Centurion 5
Sound - Creative Sound Blaster X-Fi Fatal1ty FPS
iamchel is offline  
Old 09-26-2006, 05:08 PM   #2 (permalink)
 
Contributor

Join Date: Jul 2006

Posts: 84

Ken11235

Default

The best way to do this is probably just have two variables: a counter and a total. Make their scope module level (declared at the top). When the user inputs a number, add it to the total and increment the counter. When a user wants to see the average, just divide total by counter.
Ken11235 is offline  
Old 09-27-2006, 12:02 PM   #3 (permalink)
 
True Techie

Join Date: Aug 2006

Posts: 202

iamchel

Default

yep I figured it out. Thanks for your help though
__________________
CPU - E6400 Core 2 Duo @ 3.2ghz
Cooling - Zalman CNPS9500
Motherboard - Asus P5W DH Deluxe
Memory - OCZ PC2-8000 Platinum XTC 2GB (2x1024MB)
Video - BFG 8800 GTX OC
DVD - LG Super Multi
HD - WD Raptor 36gb
HD2 - Maxtor Diamondmax 10 250gb
PSU - Corsair HX Series CMPSU-620HX 620W
Case - Cooler Master Centurion 5
Sound - Creative Sound Blaster X-Fi Fatal1ty FPS
iamchel is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On