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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top