here is the code, your help is much appricated.
Public Class Form1
Dim flavour(10) As String
Dim numSold(10) As Integer
Private Sub calx_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calx.Click
Dim count As Integer = 0
Dim fla As String
Dim num As String
Dim err As Boolean = False
Do Until count = 10
fla = InputBox("Enter the name flavour number " & count + 1, "Enter Flavour")
If fla = "" Then
MessageBox.Show("enter flavou name", "empty feild")
err = True
Else
If IsNumeric(fla) Then
MessageBox.Show("enter a name not a number", "name error")
err = True
Else : err = False
num = InputBox("Enter the number of cones sold for flavour " & count + 1)
If num = "" Then
MessageBox.Show("enter a number into dis feild", "empty feild")
err = True
Else
If Not IsNumeric(num) Then
MessageBox.Show("enter a numeric character into dis feild", "input error")
err = True
Else
flavour(count) = fla
numSold(count) = num
count += 1
End If
End If
End If
End If
Loop
calav.Enabled = True
End Sub
Private Sub calav_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calav.Click
lbox.Items.Clear()
Dim cost As Decimal = Val(tbox.Text)
Dim tcones As Integer
Dim err As Boolean = False
If (tbox.Text = "") Then
Beep()
MessageBox.Show("Pls enter the cost of the icecreame cone", "Empty Codt feild")
err = True
ElseIf err = False Then
If Not IsNumeric(tbox.Text) Then
Beep()
MessageBox.Show("Pls enter a numeric cost of a single cone", "Input Error")
err = True
ElseIf err = False Then
Dim c As Integer
For c = 0 To UBound(flavour) - 1
lbox.Items.Add(flavour(c) & vbTab & numSold(c))
tcones += numSold(c)
Next
End If
End If
disp.Text = "The total number of cones sold is " & tcones
avgcon.Text = "The average number of each cone sold is " & tcones / 10
amtsold.Text = "The total amount of cones sold is GH¢ " & Format(tcones * cost, "standard")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
calav.Enabled = False
End Sub
End Class
This post has been edited by modi123_1: 30 December 2010 - 09:55 AM
Reason for edit:: please use code tags

New Topic/Question
Reply




MultiQuote




|