On my form I have 2 textboxes called 'txtsurcharges.text' and 'txttotal.text'
txttotal retrieves a value from mysql table, but what I want to happen is that this value becomes added to when I type in a value into txtsurcharges and display the result in txttotal.
Here is my code for txtsurcharges:
txtsurcharges.Text = String.Format("£{0}", txtsurcharges.Text)
Here is my code for txttotal:
Private Sub cbxPaymentID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbxPaymentID.SelectedIndexChanged
Dim dss As New DataSet
If (cbxPaymentID.SelectedIndex <> -1) Then
Dim daa As New MySqlDataAdapter("SELECT * from payment_details WHERE PaymentID=@PID", _
objconnection)
daa.SelectCommand.Parameters.AddWithValue("@PID", Convert.ToInt32(cbxPaymentID.SelectedValue))
daa.Fill(dss)
txttotal.Text = dss.Tables(0).Rows(0)("ServicePayment").ToString()
End If
End Sub
Here is my code for the addition of the 2 values, which doesn't work:
Private Sub txtsurcharges_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtsurcharges.TextChanged
Dim c As Integer
c = Val(txtsurcharges.Text) + Val(txttotal.Text)
c = txttotal.Text
End Sub