i have this new problem i hope that im not a spam here in this site.but i have to do this bcoz i have no where else to go.sorry for my english hope u understand me.in the picture that i uploaded i have textbox1 and textbox2 their value comes from the datagrid table so i want to get the automatic sum of 1 & 2 to the 3rd textbox called "unit price".for short if i press the adodc1 controller the value of "unit price" will be change. and if i press the add to invoice command button the value in the textboxes will be save in the 2nd datagrid table. i hope you guys out there undrestand my english.i really need your help. hoping for your reply ASAP..thanx alot sincerely yours extra_rice

Almost the same as rishif2 gave you the other day.
The difference is to use the "Change" event instead of the Lost Focus event.
This causes a problem when starting because when the value of the first box changes the value of the second box is Text2 or some other value that won't add, causing a type mismatch
The is numeric goes in the change event of the first box loaded, or any other boxes before the last
if a group of boxes is being used in the calculation.

Option Explicit

Private Sub Form_Load()        
    Text1.Text = 1
    Text2.Text = 25
End Sub

Private Sub Text1_Change()
    If Isnumeric(Text2.Text) then _
    Text3.Text = Int(Text2.Text) + Int(Text1.Text)
End Sub

Private Sub Text2_Change()
    Text3.Text = Int(Text2) + Int(Text1)
End Sub
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.