Hello everyone,

I am working on my first week's assignment for Intermediate VB. It has been a couple years since I took my last VB course and I am very lost at this point. I work in Visual Studio everyday, but I mainy do scripting and I don't get to do much in the way of programming :(

The part I am stuck on is Step 3 of the assignment: Add a constructor that creates a transcation from an account number, transaction date and time, transaction amount, and current balance.

I don't know where to begin to get the variables from the other class form. The otherclass form is Account.vb and the info I need is in these variable I think:

Public Class Account

    Private m_AccountNumber As String
    Private m_AccountName As String
    Private m_Balance As Decimal
    Private m_Filename As String

    Private Shared m_AccountNumberSize As Integer = 5
    ''' <summary>
    ''' Deposit funds into the account if the amount
    ''' is greater than zero.
    ''' </summary>
    ''' 

    Public Sub Deposit(ByVal amount As Decimal)

        If amount > 0 Then
            m_Balance += amount
        End If

    End Sub

I created my transaction class (Transaction.vb) and I have almost nothing so far. I believe I have everything to append the transaction to a log file:

''' <summary>
    ''' This will create a new file if the account is new, or save the transactions to an existing file
    ''' </summary>

    Public Sub Save()

        Dim logFile As StreamWriter
        m_File = m_AccountNum & ".txt"

        If Exists(m_File) Then
            logFile = File.AppendText(m_File)
            With logFile
                .WriteLine("   Account #      Date          Amount     Balance  ")
                .WriteLine("", m_AccountNum & m_TransDate & m_Amount & m_Balance)
                .WriteLine("")
                .Close()
            End With
        Else
            With logFile
                .WriteLine("   Account #      Date          Amount     Balance  ")
                .WriteLine("", m_AccountNum & m_TransDate & m_Amount & m_Balance)
                .WriteLine("")
                .Close()
            End With
        End If

    End Sub

I don't know where to begin. How do I get the varialble from the Account.vb class which is connected to the GUI that gets the variables from the "user"? Any help in the right direction would be great:

Private m_AccountNum As String  ' customer counter number
    Private m_TransDate As Date    ' date and time of transaction
    Private m_Amount As Decimal    ' transaction amount
    Private m_Balance As Decimal   'updated account balance
    Private m_File As String 'accountname


    Public Sub Add(ByRef trans As Transaction)



    End Sub

    Public Sub New(ByVal acctNum As String, ByVal tdate As Date, ByVal amount As Decimal, ByVal balance As Decimal)



    End Sub

I am still working on this program and I have made a lot of progress on the write file portion of the transaction. I still do not know how to get the information from the teller form to the transaction class. I attached a zip of my program if anyone wants to take a look and offer some direction.

I could use some guidance on the Public Sub New and Public Sub add on the transaction form.

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.