Using '+' in DAP

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to create a DAP to let users enter the values in two text boxes
(txtScore1 and txtScore2) and show then show the total in a third text box
(txtTotal). However when I enter 4 in txtScore1 and 5 in txtScore2, I get 45
in txtTotal, instead of 9

I use txtTotal.value = txtScore1.value + txtScore2.value in the onchange
event for both txtScore1 and txtScore2. What did I do wrong? . All three text
boxes has IsNumeric = True. There is no val() function in vbScript.
 
I'm no expert on DAPs or VBScript, but a quick test indicates that while Val
doesn't seem to be supported, CInt and CDbl are ...

if txtScore1.value <> "" and txtScore2.value <> "" then
txtTotal.value = CInt(txtScore1.value) + CInt(txtScore2.value)
end if
 
Back
Top