Click here to Skip to main content
14,831,776 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I want to create a form in which i have to fill two value in two different textbox... i wantt the multiplication of the textbox value in other textbox.. i tried but didnt get... can you please help me and i want to save the textbox value in databse.. thanks in advance
Posted
Updated 15-Dec-16 23:03pm
Comments
krishnamittal 2-Jan-13 11:42am
   
TextBox3.Text=(Convert.ToInt32(TextBox1.Text)*Convert.ToInt32(TextBox2.Text);

This code is error generate.

plz how to multiply value of two textboxes into the third text box

VB
Private Sub textbox1_EditValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles textbox1.EditValueChanged
        If textbox1.Text <> "" Then
textbox3.text=cint(textbox1.text)*1
        End If
    End Sub
Private Sub textbox2_EditValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles textbox2.EditValueChanged
        If textbox2.Text <> "" and textbox2.Text <> ""  Then
textbox3.text=cint(textbox1.text)*cint(textbox2.text)
        End If
    End Sub
   
dim mul as int64
MUL=CONVERT.TOINT64(textbox1.text)* convert.toint64(textbox2.text)
textbox3.text=convert.tostring(mul)
   
JavaScript Solution is as follows:
JavaScript
function multiply()
{
   
   var textValue1 = document.getElementById('TextBox1').value;
   var textValue2 = document.getElementById('TextBox2').value;

   document.getElementById('TextBox3').value = textValue1 * textValue2;

}
   
v2
Comments
Shrikesh_kale 8-Jul-15 0:40am
   
how to call on text change
if you want to diplay this value u can write like this.
C#
TextBox3.Text=(Convert.ToInt32(TextBox1.Text)*Convert.ToInt32(TextBox2.Text);


or if u want use this textbox3 value for again calculation purpose means again u need to convert this texbox3 value

like
C#
convert.Toint32(TextBox3.text)
   
v2
Firstly you need to type cast values of both text boxes into integer.

C#
Example: TextBox3.Text=Convert.ToString(Convert.ToInt32(TextBox1.Text)*Convert.ToInt32(TextBox2.Text));
   
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900