Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 7 of 7
  1. #1
    Join Date
    May 2011
    Location
    LANDAN
    Posts
    2,758
    Tokens
    4,036
    Habbo
    CrazyLemurs

    Latest Awards:

    Default CInt in Visual Basic

    Hey everyone
    I'm doing 1/3 of 30% of my Computing CA and it's come up in it that I've got to program an ISBN book number calculator
    I take in a 10digit number and have to make it to 11digits using some special formula etc etc.
    But I take in the number as a string (so if they like type 123456789Q it doesnt crash the program) and have applied an if statement so IF userenter = 1 then DO CONVERSION TO 11DIGITS
    But if they type in like ASBHFHKFLJHBS then I have an error as I cant subject a string to operators like = and +.
    My teacher said to use CInt command to do this, but how does it work?
    And is there any other way I can go about it if CInt isn't ideal?
    Thanks in advance for your assistance xxxxxx

    people know me because of that shower thing one time and I do not regret anything

    upon further review I feel a rather mild regret is warranted

  2. #2
    Join Date
    Oct 2006
    Posts
    9,900
    Tokens
    26,832
    Habbo
    Zak

    Latest Awards:

    Default

    You can convert a string into an integer value by using CInt, or probably better CLng. (CLng accepts a larger amount than CInt).

    If you're doing it via database design it's simple. It'll be CInt([TABLENAME].[FEILDNAME]). Though sometimes I use Val().

    I have no idea what it would be in VB but I'm guessing it's very similar (google it ). In short, CInt or CLng just converts a String value to an integer value. SIMPLES!

  3. #3
    Join Date
    Jul 2004
    Location
    Scotland
    Posts
    17,702
    Tokens
    60,948
    Habbo
    Habbic

    Latest Awards:


  4. #4
    Join Date
    May 2011
    Location
    LANDAN
    Posts
    2,758
    Tokens
    4,036
    Habbo
    CrazyLemurs

    Latest Awards:

    Default CInt in Visual Basic

    Thanks you two
    My computing teacher isn't allowed to tell me how to use it because that's cheating and telling me how to solve the program, but I'm within full ability to google an answer


    I'm currently on my iPhone if you are seeing this message! I cannot participate in spam wars xx

    people know me because of that shower thing one time and I do not regret anything

    upon further review I feel a rather mild regret is warranted

  5. #5
    Join Date
    Oct 2006
    Posts
    9,900
    Tokens
    26,832
    Habbo
    Zak

    Latest Awards:

    Default

    Quote Originally Posted by CrazyLemurs View Post
    Thanks you two
    My computing teacher isn't allowed to tell me how to use it because that's cheating and telling me how to solve the program, but I'm within full ability to google an answer


    I'm currently on my iPhone if you are seeing this message! I cannot participate in spam wars xx
    No problem, it's very easy to implement. You should have no problem

  6. #6
    Join Date
    May 2011
    Location
    LANDAN
    Posts
    2,758
    Tokens
    4,036
    Habbo
    CrazyLemurs

    Latest Awards:

    Default

    Will it work if the string I enter is like FDKSUGFJKHSTB?

    people know me because of that shower thing one time and I do not regret anything

    upon further review I feel a rather mild regret is warranted

  7. #7
    Join Date
    Jul 2004
    Location
    Scotland
    Posts
    17,702
    Tokens
    60,948
    Habbo
    Habbic

    Latest Awards:

    Default

    use IsNumeric(varName) to check

Posting Permissions

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