Hello,
I am trying to create a program for use at my job that will track the time each employee spends on particular jobs we process.
I have 2 forms, form1 and form2. form1 takes input from the employee (name, job#, process) stores them in a structure 'Session' and then writes 'Session' to the array called 'Sessions'. When the form1's submit button is clicked it launches form2 which will display the name, job#, process, and start/end time and should eventually write the information to an excel file when the employee pushes stop. However, I am having trouble accessing any of the information stored in Sessions from form2. Am I storing it in the array incorrectly? or do i need to declare the array differently?
Here is the code I have from form1, any help is appreciated, thanks in advance
I am trying to create a program for use at my job that will track the time each employee spends on particular jobs we process.
I have 2 forms, form1 and form2. form1 takes input from the employee (name, job#, process) stores them in a structure 'Session' and then writes 'Session' to the array called 'Sessions'. When the form1's submit button is clicked it launches form2 which will display the name, job#, process, and start/end time and should eventually write the information to an excel file when the employee pushes stop. However, I am having trouble accessing any of the information stored in Sessions from form2. Am I storing it in the array incorrectly? or do i need to declare the array differently?
Here is the code I have from form1, any help is appreciated, thanks in advance
VB.NET:
Public Class Form1
'declaring a structure named Session
Structure Session
Dim sName As String
Dim sJob As String
Dim sProcess As String
Dim sIndex As Integer
Dim sStart As DateTime
Dim sEnd As DateTime
End Structure
Public Shared Sessions(30) As Session
Public Shared index As Integer = 0
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Sessions(index).sName = txtName.Text
Sessions(index).sJob = txtJob.Text
Sessions(index).sProcess = ddProcess.SelectedIndex.ToString
Sessions(index).sStart = Now
Sessions(index).sIndex = index
index = index + 1
Dim f2 As New Form2()
f2.Show()
End Sub
End Class