Results 1 to 5 of 5

Thread: Convert String to integer

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    208

    Question

    I do this:

    TXT_total.text=TXT_1.text + TXT_2.txt

    TXT_1 = 1
    TXT_2 = 2

    The command do that : 12
    but I want that : 3

    I dont want to put a VARIABLE if possible ..
    Did someone know how ??
    like:

    dim TXT_total.text as integer

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    try:

    TXT_total.text=CINT(TXT_1.text) + Cint(TXT_2.txt)

    for your example

  3. #3
    Hyperactive Member
    Join Date
    Jun 2000
    Posts
    299

    Talking Yay one i can do!! hahaha

    use the val function
    TXT_total.text=Val(TXT_1.text) + Val(TXT_2.text)
    Easy as.
    BW

  4. #4
    Guest
    If I'm not correct, Val converts it into a double, unless you specificly declare it as Integer.
    Code:
    Dim A As Integer
    
    A = Val(Text1)
    Print TypeName(A)
    [Edited by Megatron on 09-21-2000 at 06:09 PM]

  5. #5
    Hyperactive Member
    Join Date
    Jun 2000
    Posts
    299

    Wink DOH!!!

    Megatron, i need you to work with me, and then my code would be 100% bug free!!
    Once again, you spot my flaw. You are indeed correct, i didn't see the last line saying that the textline was an int, and figgered it was a string.
    Well spotted. Damn my evil skim reading !!! hahahah
    BW
    PS i thought it would work anyway
    Oh it does... and he did (declare as an int) so it all worked out.

    [Edited by But_Why on 09-21-2000 at 06:18 PM]

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