Hello all! I am trying to read a file using a constructor. Here is what I have thus far...
Private f() As UNR.Employees.Employee

VB Code:
  1. Private Sub mmuOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
  2.  
  3.         Dim ofdMain As New OpenFileDialog
  4.         Dim dlgResult As DialogResult
  5.         dlgResult = ofdMain.ShowDialog()
  6.         f() = New UNR.Employees.EmployeeList(ofdMain.FileName)
  7.  
  8.  End Sub
This is the click even that needs to lead to this.....
VB Code:
  1. Public Sub New(ByVal pstrFileName As String)
  2.             Dim pstrCurrent As String
  3.             Dim pstrFields() As String
  4.             Dim pstrDelimiter() As Char = {ToChar(",")}
  5.             Dim psrdcurrent As New System.IO.StreamReader(pstrFileName)
  6.  
  7.             pstrCurrent = psrdcurrent.ReadLine()
  8.             Do Until pstrCurrent = Nothing
  9.                 Dim recNew As New Employee
  10.                 pstrFields = pstrCurrent.Split(pstrDelimiter)
  11.                 recNew.ID = ToInt32(pstrFields(0))
  12.                 recNew.LastName = pstrFields(1)
  13.                 recNew.FirstName = pstrFields(2)
  14.                 recNew.SSN = pstrFields(3)
  15.                 recNew.HoursWorked = ToDouble(pstrFields(4))
  16.                 recNew.HourlyWage = ToDouble(pstrFields(5))
  17.                 recNew.Age = ToInt32(pstrFields(6))
  18.                 alEmployee.Add(recNew)
  19.                 pstrCurrent = psrdcurrent.ReadLine()
  20.             Loop
  21.             psrdcurrent.Close()
  22.             mintCurrent = 0
  23.  
  24.         End Sub
I am having trouble getting the file that I open to "transfer" over to the constructor to read it into an array. Thanks in advance!!