Derek:
I just copied your code onto a form and added the five textboxes. I
commented out ShowFields because I don't know what that does. It works
fine. Being that everything here is an int, I'm inclined to think something
else is the problem. you could also try price1.Parse(txtcost1.text) etc but
Ints are going to add not concatenate.
If you debug.WriteLine after the TotalPrice line,
Debug.WriteLine(TotalPrice.ToString), what number do you get?
Also, if any of those text boxes contain nonnumeric data or are empty,
you're going to have some drama, so make sure you don't let the user hit the
Calc button until all the info is good.
Post the rest of the code block, we can figure this one out.
HTH,
Bill
HTH,
Bill
"Derek" <de**********@charleston.af.mil> wrote in message
news:63****************************@phx.gbl...
I am trying to add the text of several textboxes as a sum
using the + sign but even converting to integer it is
concatenating. Any help would be greatly appreciated.
Dim price1 As Integer
Dim price2 As Integer
Dim price3 As Integer
Dim price4 As Integer
Dim price5 As Integer
Dim TotalPrice As Integer
price1 = CType(txtcost1.Text, Integer)
price2 = CType(txtcost2.Text, Integer)
price3 = CType(txtcost3.Text, Integer)
price4 = CType(txtcost4.Text, Integer)
price5 = CType(txtcost5.Text, Integer)
TotalPrice = price1 + price2 + price3 + price4 +
price5
txtEC.Text = TotalPrice
ShowFields()