Results 1 to 3 of 3

Thread: NooBi to VBScript but vb knowledged

  1. #1

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335

    NooBi to VBScript but vb knowledged

    OK i know vb alot. and VBscript doesnt seem to different. But im learning that vbscript is supposed to change variable tyes automatically but in this case i think i did somethine wronge here. Look at the below snippet im just trying to use the variable to add whats in 1 text box to another , i get no error but when i add 1 + 1 i get = 11.
    VB Code:
    1. <script language="VBScript">
    2. sub StartAdd_OnCLick()
    3. dim x1
    4. dim x2
    5.     x1 = No1.value
    6.     x2 = No2.value
    7.    
    8.     No3.value = x1 + x2
    9. end sub
    10. </script>
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Because they are in a text box, VBScript thinks they are strings... so it adds the strings together, creating "11" instead of the exoected "2".... I don't remember if VBScript supports them or not, but check out CInt or CLng.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    cool i remeber those from C++ i thnk and vb. Nice work. Works great thanks. I didnt think to try those out. Thanks Again
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width