The class returns an error message

I have written the code and I am new to working with classes. If someone could point me in the right direction I think I can figure it out. I looked at MSDN and learned this much, so maybe I didn't get the right understanding but I thought I would give it a try. When I run the application I use a combobox to select option 1 or option 2 , however this results in an error.

I found some things that you might wanna look at.
If for example the files csvSAVINGS.TXT or csvCHECKING.TXT does not exists then you might wanna change some of the code for the file reading.

In the method CalcBalance, in the Account class, you cannot ReDim m_transSet if the variable x is -1.
When ReDim'ing you have to state the amount of positions in the array to use. Meaning, if the size of the array is supposed to be 1 then the variable x must be declared as 1, not 0 or -1. ReDim variable(<number of positions to declare>) My next suggestion is to check the state of m_transSet in the Balance property:

Public ReadOnly Property Balance() As Double
Get
If m_transSet IsNot Nothing Then
Return m_transSet(m_transSet.Length - 1).NewBalance
Else
Return <a default number if all failes>
End If
End Get
End Property

I found some things that you might wanna look at.
If for example the files csvSAVINGS.TXT or csvCHECKING.TXT does not exists then you might wanna change some of the code for the file reading.

In the method CalcBalance, in the Account class, you cannot ReDim m_transSet if the variable x is -1.
When ReDim'ing you have to state the amount of positions in the array to use. Meaning, if the size of the array is supposed to be 1 then the variable x must be declared as 1, not 0 or -1. ReDim variable(<number of positions to declare>) My next suggestion is to check the state of m_transSet in the Balance property:

Public ReadOnly Property Balance() As Double
Get
If m_transSet IsNot Nothing Then
Return m_transSet(m_transSet.Length - 1).NewBalance
Else
Return <a default number if all failes>
End If
End Get
End Property

Thanks, your code helped I have completed the deposit and withdrawal buttons, but I am royally stuck on how to get the transfer button to work. It is also returning NULL ref. Do you think it is possible to use the same Public property NewBalance for the transfer to work. I have tried but my attempts fail.
Let me know what you guys think.
PuPpY

Well. I couldn't really see anything wrong with your logic.
However, what can you see when you debug your transaction code and step through each line to see what line creates the NULL reference?
Just put a breakpoint at Private Sub btnTransfer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTransfer.Click and follow the code.

Well. I couldn't really see anything wrong with your logic.
However, what can you see when you debug your transaction code and step through each line to see what line creates the NULL reference?
Just put a breakpoint at Private Sub btnTransfer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTransfer.Click and follow the code.

I just looked at the code and decided to use a different approach. I will probably mark this as solved and start a new post because I solved the class errors. It is now a matter of the redim preserve statement. At any rate, here is the code.

Here a small suggestion of how to read from textfiles.
It's just a small change of what you showed us in your original post.
And if you're looking for specific information stored in the files you can simply add an If statement. See code in red.

Dim stream As FileStream = Nothing
Dim tr As TextReader = Nothing
Dim line As String = ""
Dim fileInput() As String
If NameOfAccount.Equals("Savings") Then
stream = New FileStream("csvSAVINGS.TXT", FileMode.Open)
ElseIf NameOfAccount.Equals("Checkings") Then
stream = New FileStream("csvCHECKKINGS.TXT", FileMode.Open)
End If
tr = New StreamReader(stream)
While tr.Peek <> -1
line = tr.ReadLine()
If line.Contains("string to search for") Then
tran = New Transaction()
fileInput = line.Split(","c)
tran.TransactionDate = fileInput(0)
.......
End If
End While