Consulting

Results 1 to 5 of 5

Thread: The equivalent for CInt for creating a long

  1. #1

    The equivalent for CInt for creating a long

    Hi everyone,

    Now I am using


    lvoorwas = CInt(txtlvwas.Text)
    rvoorwas = CInt(txtrvwas.Text)
    hoofdwas1 = CInt(txthwas1.Text)
    hoofdwas2 = CInt(txthwas2.Text)
    week = CInt(txtdatum.Text)
    totvoorwas = lvoorwas + rvoorwas
    tothoofdwas = hoofdwas1 + hoofdwas2
    txttotvwas.Text = totvoorwas
    txttothwas.Text = tothoofdwas

    to be able to calculate with the numbers that are typed into text boxes, only when the number I enter goes higher then 33000-something, the thing goes boom, because integer dont handle those numbers. What is the equivalent for CInt for creating a long instead of an integer?

    TIA

  2. #2
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Hi Regouin,

    Try
    lvoorwas = CLng(txtlvwas.Text)
    'etc
    HTH,

    john
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  3. #3
    that was what I was looking for but i couldnt find it anywhere in the helpfiles

    thanks

  4. #4
    VBAX Contributor Richie(UK)'s Avatar
    Joined
    May 2004
    Location
    UK
    Posts
    188
    Location
    Quote Originally Posted by Regouin
    that was what I was looking for but i couldnt find it anywhere in the helpfiles

    thanks
    Hi Regouin,

    If you place your cursor in the keyword CInt and then press the F1 button you should get the Help file details for "Type Conversion Functions" which details all of the type conversions including CInt and CLng. This is often far quicker than trying to search through the Help files yourself (although just typing CInt in the search found the same section).

    HTH

  5. #5
    thanks for the advice but I tried typing in CInt in the help window but nothing related came up, I know there would be an easy solution, but i just couldnt find the right parameters anywhere.


    [EDIT]

    F1 indeed did the trick, thanks again. How ever when I type it in the help window I have to search for conversion and not CInt, so that is rather confusing. But it is all solved now.

    [/EDIT]

Posting Permissions

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