I enter a name into a text box as well as a score (from 0-100) into a separate text-box then i press 'Add to array'
and they go into the array BUT THE DON'T SHOW UP until i press "Show me the array.
Once i press "show me the array" i get my names and scores in 2 separate parallel arrays (which is what i want)
but now i need to assign a grade to each student (preferably next to each students score and name.
I have no idea how to do this, possibly use Case-where or a series of 'If' statements?
My Program Display: http://puu.sh/Cw1d
All of my code:
Public Class frmCreateArray
Dim Names(21) As String
Dim NamesCount, ListCount As Integer
Dim Ages(21) As Double
Dim AgesCount, ListCount2 As Integer
Dim sum As Integer
Dim NumberCount As Integer
Dim Total As Double
Dim Average As Double
Dim Item As Double
Private Property items As Object
Private Sub cmdEnterThisName_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEnterThisName.Click
NamesCount = NamesCount + 1
Names(NamesCount) = txtNamesGoHere.Text
AgesCount = AgesCount + 1
Ages(AgesCount) = txtAgesGoHere.Text
lblCounter.Text = Str(NamesCount) + " Students Entered"
lblCounter.Text = Str(AgesCount) + " Students Entered"
txtNamesGoHere.Text = "" : txtAgesGoHere.Text = ""
txtNamesGoHere.Focus()
End Sub
Private Sub frmCreateArray_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
NamesCount = 0
AgesCount = 0
End Sub
Private Sub cmdShowListArray_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShowListArray.Click
For Me.ListCount = 1 To NamesCount
lstListNames.Items.Add(Names(ListCount))
Next
For Me.ListCount2 = 1 To AgesCount
lstListAges.Items.Add(Ages(ListCount2))
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClearAll.Click
txtNamesGoHere.Text = ""
txtAgesGoHere.Text = ""
lblavg.Text = "..."
lstListNames.Items.Clear()
lstListAges.Items.Clear()
lblCounter.Text = " Number of names entered"
txtNamesGoHere.Focus()
End Sub
Private Sub btnAvg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAvg.Click
For Each Me.Item In lstListAges.Items
Total = 0
For Me.AgesCount = 0 To AgesCount
Total = Total + Ages(AgesCount)
Next
lblavg.Text = Total / NamesCount
Next
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtNamesGoHere.Text = ""
txtAgesGoHere.Text = ""
End Sub
End Class
WRONG NAME! :0 SORRY!

New Topic/Question
Reply



MultiQuote



|