Click here to Skip to main content
15,915,840 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
See i have total 5 text boxes like

TotalTextbox
Total1TextBox
Total2TextBox
Total3TextBox
Total4TextBox


what i want is the sum of these text box should appear in grand Total Text Box

please tell me the code for visual basic 2010
Posted
Comments
Nelek 2-Dec-12 13:23pm    
You already received an answer to start trying, but for the next time you should read:
what have you tried?[^]
If you understand the points explained there, you will increase the chances to receive solutions to your problems
[no name] 2-Dec-12 19:21pm    
Please answer the question i don't ask you tell Something crap
see a biginer can't try all possible methods for solution i tried some them but didn't worked so i asked a question what's wrong in it haa?

I'm using only 2 textboxes, Make changes as per your requirements :-
VB
Private Sub txtMonT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Handles txtMonT.TextChanged
    Dim number1 As Double
    Dim number2 As Double

    If Double.TryParse(txtMon1.Text, number1)
        And Double.TryParse(txtMon2.Text, number2) Then
        txtMonResult.Text = (number1 + number2).ToString()
    End If
End Sub
 
Share this answer
 
Comments
[no name] 2-Dec-12 21:06pm    
dear Krunal Rohit,

i tried my code like this i double clicked grand total text box and entered the following code but nothing happens. what to do now sir please tell me

Private Sub Grand_TotalTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Grand_TotalTextBox.TextChanged
Dim number1 As Double
Dim number2 As Double
If Double.TryParse(TotalTextBox.Text, number1) And Double.TryParse(Total1TextBox.Text, number2) Then
Grand_TotalTextBox.Text = (number1 + number2).ToString()
End
End If
i think i didn't inserted the code in rightplace.pls tell me what to do
take a button int text field name it as Grand Total Button then double click it

VB
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

    Dim Tot, Tot1, Tot2, Tot3, Tot4, Gtot As Double

    Tot = Val(TotalTextBox.Text)
    Tot1 = Val(Total1TextBox.Text)
    Tot2 = Val(Total2TextBox.Text)
    Tot3 = Val(Total3TextBox.Text)
    Tot4 = Val(Total4TextBox.Text)


    Gtot = Tot + Tot1 + Tot2 + Tot3 + Tot4
    Grand_TotalTextBox.Text = Val(Gtot).ToString
End Sub

VB

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 3-Jun-13 13:55pm    
Who are you talking to? To yourself? Not interesting to anyone, really.
How do you think, why you already have 3 abuse reports on your account (account, not just particular posts)? Eventually, it can lead to loss of your membership...
—SA

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