I have tried all possible combinations of data conversion; all with the same
outcome. The exception gets thrown when the Random constructor takes a seed
parameter such as Cint(Now.Tick). As you state "...the conversion will fail
if "Ticks" value cannot be represented in an Integer" how am I supposed to
pass in the value? The MSDN documentation on Random() uses the code I am
trying to replicate.
WB
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ez****************@TK2MSFTNGP10.phx.gbl...
"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/>