Re: CInt in VB.net

From: Marc M (nospam_at_mail.com)
Date: 01/18/05


Date: Tue, 18 Jan 2005 09:37:40 -0600

CInt will convert to Integer
Use CDouble.
All C????? are old VB 6.0 syntax

In .Net use CType to convert like

If CType(input, Double) .......

Hope this helps

Marc M
MCSD (6.0 & .NET)

anonymous@discussions.microsoft.com wrote:

> Hi,
>
> I have a question regarding the use of CInt and/or Char
> member functions.
>
> Let's say I have an input string,
>
> Dim input As String = "7.5"
>
> and I need to check if this string(number) is either 7 or
> 8 (or so on....), I use the CInt function and compare the
> value using If-statement.
>
> "7.5" is supposed to return false to me but CInt now
> turns it into 8 (so it returns true now)
>
> Any ideas to fix that?
>
> thanks.



Relevant Pages

  • Re: VB Conversion Keywords And .NET Conversion Routines
    ... > efficient than CType when it can be used, but isn't the single use of CType ... > easier and more consistent than the various CInt, Cstr, CBool, CDbl, etc. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: VB Conversion Keywords And .NET Conversion Routines
    ... > efficient than CType when it can be used, but isn't the single use of CType ... > easier and more consistent than the various CInt, Cstr, CBool, CDbl, etc. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: VB Conversion Keywords And .NET Conversion Routines
    ... would not then Cint and Cdbl or Ctype maintain more consistency of ... > code and automatically utilize 8 byte integers as opposed to ...
    (microsoft.public.dotnet.languages.vb)
  • Re: VB Conversion Keywords And .NET Conversion Routines
    ... would not then Cint and Cdbl or Ctype maintain more consistency of ... > code and automatically utilize 8 byte integers as opposed to ...
    (microsoft.public.dotnet.framework.performance)
  • Re: calculated values
    ... I thought I had set in my messages, that if there would be decimals to use CDouble, I used Cint to show how simple it was. ... M S Herfried K. Wagner ...
    (microsoft.public.dotnet.languages.vb)