Tim
You shouldn't need to even cast it at all. RB has autoconversion
between numeric types, so you can just assign a double to an integer
and RB will automatically truncate the decimal part for you. This
will work fine.
Me.width = Graphics.Stringwidth(thestring)
Alternatively you may want to use the Round function to minimize the
truncation error.
Me.Width = Round(Graphics.Stringwidth(thestring))
BTW Thanks for reminding me that StringWidth now returns a double.
Regards,
Joe Huber
Hi Folks,
If a function returns a Double, but need I an integer, shouldn't I
be able to simply cast the result of a call that returns a double to
an integer?
Me.Width = Integer(Graphics.Stringwidth(thestring))
The compiler informs me that it "Expected Int32, but got Double".
Isn't that supposed to be resolved by the cast to Integer?
A slightly confused,
Tim
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|