Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[VB6 ONLY] Need help with a project please!

Newbie Spellweaver
Joined
Oct 16, 2008
Messages
85
Reaction score
0
I am making a project for my class and I can't get some things right. I would like someone to help me with some problems I'm having with it (please don't tell me the code, Just tell me what it should LOOK like so i can adjust it so). I will post the source here. My class only uses VB6 and we are still beginning so please keep it simple xD

Problems:

I also need to prevent division by zero from breaking my program.
Example: I don't enter any value and click calculate and my program breaks. I need to prevent that.

Thank you all for the help.

Sincerely,
~~Blufner

*ATTACHED THE SOURCE CODE AND FORM!!!*

Code:
'Charles Turner
'Teacher Project 2
'November 10, 2008

Dim Message As String
Dim sum As Integer
Dim c As Integer
Dim x As Integer
Dim aver As Double

Private Sub Calculate_Click()
Display.Clear
'Calculate the average
aver = sum / c
'decimal chop
aver = aver * 100
aver = Int(aver)
aver = aver / 100
'Displays the variables and the selected message
Message = "The total of your"
Display.AddItem (Message)
Message = "numbers are " & sum
Display.AddItem (Message)
Message = " "
Display.AddItem (Message)
Message = "with " & c & " numbers."
Display.AddItem (Message)
Message = " "
Display.AddItem (Message)
Message = "The average is "
Display.AddItem (Message)
Message = aver & "."
Display.AddItem (Message)

End Sub

Private Sub Clear_Click()
Text = 0
c = 0
sum = 0
x = 0
Display.Clear
Text.SetFocus
End Sub

Private Sub Enter_Click()
'Increases the sum
sum = sum + x
'Increases the count of numbers entered
c = c + 1
'Displays Number entered on the display screen
Display.AddItem (x)
Text = 0
Text.SetFocus
End Sub

Private Sub Exit_Click()
End
End Sub

Private Sub Form_Load()
c = 0
sum = 0
x = 0
aver = 0
Display.Clear
End Sub

Private Sub Text_Change()
x = Text.Text
Text.SetFocus
End Sub
 

Attachments

You must be registered for see attachments list
Last edited:
Newbie Spellweaver
Joined
Nov 18, 2008
Messages
5
Reaction score
0
i re-did your project, learn from it. :sleep:
 

Attachments

You must be registered for see attachments list
Back
Top