Ok so I am supposed to be making a checkbook organizer but I am having some problems and need some help. First of all I need to lock the BgngBalance text box after first use. I also need to have the newbalance transfer to the next transaction. and I want to disable the Deposit or Withdrawal depending on which one is used until the transaction is completed or make it a 0 if not used at all. I am really lost any help would be greatly appreciated.

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim BgngBalance As Double = 0
        Dim Deposit As Double = 0
        Dim Withdrawal As Double = 0



    End Sub

    Private Sub CalculateTransaction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateTransaction.Click
        Dim NewBalance As Double


        'Set List View Properties
        ListView1.View = View.Details
        ListView1.GridLines = True
        ListView1.FullRowSelect = True
        ListView1.HideSelection = False
        ListView1.MultiSelect = False

        ListView1.Columns.Add("Transaction Date", 200)
        ListView1.Columns.Add("Deposit", 90)
        ListView1.Columns.Add("Withdrawal", 113)
        ListView1.Columns.Add("Current Balance", 175)
        ListView1.Columns.Add(vbNewLine)

      

        Dim str(5) As String
        Dim itm As ListViewItem
        str(0) = System.DateTime.Now
        str(1) = DepositTxt.Text
        str(2) = WithdrawalTxt.Text
        str(3) = BegBalanceTxt.Text - CInt(WithdrawalTxt.Text) + CInt(DepositTxt.Text)
        itm = New ListViewItem(str)
        ListView1.Items.Add(itm)

        
       





    End Sub
    Private Sub RstButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RstButton.Click
        BegBalanceTxt.Text = ""
        DepositTxt.Text = ""
        WithdrawalTxt.Text = ""
        ListView1.Clear()
    End Sub

    Private Sub ExitBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitBtn.Click
        Me.Close()

    End Sub
    
End Class

For the first problem, locking the textbox.
Add this event:

Private Sub BegBalance_Leave(ByVal sender As Object, ByVal e As EventArgs) Handles BegBalance.Leave
   If BegBalance.Text = String.Empty OrElse BegBalance.Text = "0" Then Exit Sub
   BegBalance.ReadOnly = True
End Sub

And then, in your RstButton click event. Add the line BegBalance.ReadOnly = False In order to keep track of the new balance, you should move the declaration of the variable NewBalance outside any methods, making it a class variable.
So, when you calculate the new balance, just dump the result into that variable, and reuse that value when calculating the next new balance. And so on and so on.

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.