[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Calculate text from two text boxes into another text box

I have two text boxes that  txtbox1 require the operator to enter a value, this value is the initial RAW weight then Txt BOX2 is the final weight after some gain, on TXTbox3 I want to give me a calculated percent value as the values are input on the TXTBOX1 and TXTBOX2 , but I need to get this gain value without any CLICK bottoms, as soon as the operator input the value on TXTBOX1 or TXTBOX2   I want to see percent values on TXTBOX3
0
teogos
Asked:
teogos
1 Solution
 
Ravi SinghSenior Software EngineerCommented:
Which programming language are you using? After looking at your recently asked question I'll assume your using visual basic for now...

You can handle the Change event for textbox1, textbox2... in the event handling procedure you can update textbox3 with the calculation result depending on whats already in textbox1 and 2... small example to give you an idea:

Private Sub txtBox1_Change()
    If Trim(Me.txtBox1.Text) <> "" And IsNumeric(Me.txtBox1.Text) Then        
         If Trim(Me.txtBox2.Text) <> "" And IsNumeric(Me.txtBox2.Text) Then
            Me.txtBox3.Text = <Your calculation here>
        End If
    End If
End Sub

Private Sub txtBox2_Change()
    If Trim(Me.txtBox2.Text) <> "" And IsNumeric(Me.txtBox2.Text) Then        
         If Trim(Me.txtBox1.Text) <> "" And IsNumeric(Me.txtBox1.Text) Then
            Me.txtBox3.Text = <Your calculation here>
        End If
    End If
End Sub

This should change the value of txtBox3 as and when the values are typed into txtBox1 & 2
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now