I procrastinate like you would believe! I have this homework project due tomorrow and I keep getting errors specifically with "index" do I have to declare it somewhere or add a specific item form the Toolbox on my form? I'm stuck help!!
Code:Public Class Form1 Dim Wname(10) As String Dim Hours(10) As Integer Dim Wages(10) As Integer Dim Wpay(10) As Integer Private index As Integer = 0 Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click Dim nind As Integer = 0 Dim ind, total As Integer Dim fmtStr As String = "{0,-10} {1,20}" For ind = 0 To index total += Wpay(ind) Next lstSummary.Items.Add(String.Format(fmtStr, "Worker Name", "Payment")) For nind = 0 To index - 1 lstSummary.Items.Add(String.Format(fmtStr, Wname(nind), Wpay(nind))) Next lstSummary.Items.Add("Total Workers Processed :" & index) lstSummary.Items.Add("Total Wages Payed :" & total) End Sub Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click Wname(index) = txtName.Text Hours(index) = CInt(txtHours.Text) Wages(index) = CInt(txtWage.Text) If Hours(index) > 40 Then Wpay(index) = 1.5 * Wages(index) * Hours(index) Else Wpay(index) = Hours(index) * Wages(index) End If index += 1 txtName.Clear() txtHours.Clear() txtWage.Clear() txtName.Focus() End Sub End Class




Reply With Quote
