Im hoping someone can help, I am working on a small program for class and have an array coming from a txt document.
My application populates the array and data when I open it, however I am having trouble working out how to code my Next / Back buttons to cycle through the array
and for the back button to be disabled if I am displaying the first records, and the next button to be disabled if I am displaying the last record.
If you could maybe point me in the direction of articles or tutorials that could help me learn how to do this I would greatly appreciate it.
Here is the code I have so far
-
Private Sub MdiAllRecordsForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
-
Call populateArray()
-
-
-
Dim ArrayNum As Integer
-
Dim sngTotal As Single
-
Dim sngAverage As Single
-
-
For mintRow = 1 To 5
-
-
ArrayNum = mintRow
-
-
Me.txtHourlyEmp.Text = strEmpName(mintRow)
-
-
Next
-
-
-
For mintColumn = 1 To 5
-
-
If ArrayNum = mintColumn Then
-
-
Me.txtWeek1.Text = sngEmpSalary(mintColumn, 1)
-
Me.txtWeek2.Text = sngEmpSalary(mintColumn, 2)
-
Me.txtWeek3.Text = sngEmpSalary(mintColumn, 3)
-
Me.txtWeek4.Text = sngEmpSalary(mintColumn, 4)
-
-
sngTotal = sngEmpSalary(mintColumn, 1) + sngEmpSalary(mintColumn, 2) + sngEmpSalary(mintColumn, 3) + sngEmpSalary(mintColumn, 4)
-
-
sngAverage = sngTotal / 4
-
-
Me.txtAveragePay.Text = sngAverage
-
-
End If
-
-
End Sub
This is my populate array code:
-
Module mdlEmployee
-
Const maxemployee As Integer = 5
-
Const maxsalary As Integer = 4
-
Public sngEmpSalary(maxemployee, maxsalary) As Single 'stores an employee’s salary
-
Public strEmpName(maxemployee) As String 'stores an employee’s name
-
Public mintRow, mintColumn As Integer
-
-
-
Public Sub populateArray()
-
-
Try
-
FileOpen(1, "Hourly Staff.txt", OpenMode.Input)
-
mintRow = 1
-
-
Do While Not EOF(1)
-
Input(1, strEmpName(mintRow))
-
-
For mintColumn = 1 To 4
-
Input(1, sngEmpSalary(mintRow, mintColumn))
-
-
Next
-
mintRow = mintRow + 1
-
-
Loop
-
-
FileClose(1)
-
-
Catch ex As System.Exception
-
MessageBox.Show(ex.Message)
-
-
End Try
-
-
-
-
End Sub
-
-
-
End Module