Re: data converstion from long to int

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"wb" <none> schrieb:
dim x as long
dim z as integer
x = datetime.now.tick

z = int(x)

when the coversion takes place an exception error is thrown. maybe it isn't possible to convert a long to an int. But that is what the constructor takes and the help says that time is a good value to pass in.

'Int' will return a floating point number. It's typically get used to remove the fractional part of a number. You may want to use 'CInt' instead which will perform a type conversion. Note that this conversion will fail if 'Ticks'' value cannot be represented in an 'Integer'.


--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


.



Relevant Pages

  • Re: sizeof A
    ... Because 'A' alone is an int. ... Single quotes in this context actually specify a type conversion, ... to the ASCII value of 'A'. ...
    (comp.lang.c)
  • Re: unsigned int
    ... But PHP do not support unsigned integer. ... I need to convert it to signed int and work with it as a number. ... Converting it in mysql is anoying too, because mysql cant do signed 32-bit int type conversion, only 64 bit. ...
    (comp.lang.php)
  • Re: sizeof A
    ... Could you tell me why sizeof 'A' is taken as 4? ... Because 'A' alone is an int. ... Single quotes in this context actually specify a type conversion, ...
    (comp.lang.c)
  • Re: sizeof A
    ... Because 'A' alone is an int. ... Single quotes in this context actually specify a type conversion, ... No, the single quotes specify a charater constant, which is inherently ...
    (comp.lang.c)