Professional Web Applications Themes

Operator is not Valid - ASP.NET General

Integer conversion can be done with cint(variable) or system.convert.ToInt32(variable) or bitconverter.ToInt32(variable). An integer (if you are using 'dim i as integer') is the equivalent of a 32-bit signed integer. Don Krapohl http://www.tranquillitas.com Website quality assurance testing...

  1. #1

    Default Re: Operator is not Valid

    Integer conversion can be done with cint(variable) or
    system.convert.ToInt32(variable) or bitconverter.ToInt32(variable).
    An integer (if you are using 'dim i as integer') is the equivalent of
    a 32-bit signed integer.


    Don Krapohl
    http://www.tranquillitas.com
    Website quality assurance testing
    DKrapohl Guest

  2. #2

    Default Re: Operator is not Valid

    Thank you for your help, but now I'm getting this message:

    "System.InvalidCastException: Cast from type 'UInt16' to type 'Integer' is
    not valid."

    I tried using cint(entry("LoadPercentage")). None of the other conversion
    methods you listed seem to work. I'm using VB, not C. I don't know if that
    makes a difference.

    I apologize. I've gotten lazy by using Perl too much. I haven't had to
    declare types in a few years and I'm a bit rusty. I'm totally new to the
    way .NET does it.

    I appreciate your help.

    -Kevin


    Kevin Guest

  3. #3

    Default Re: Operator is not Valid

    Integers in .Net are of the type Int32.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    The more I learn, the less I know.

    "Kevin Vaughn" <edu> wrote in message
    news:supernews.com... 
    that 


    Kevin Guest

  4. #4

    Default Re: Operator is not Valid

    Dim shtOriginal As Int16 = 4
    Dim intConverted As Integer
    intConverted = System.Convert.ToInt32(shtOriginal)

    This is VB.NET source for the conversion. It worked fine for me. Let
    me know if you are still having problems.


    Don Krapohl
    http://www.tranquillitas.com
    Website quality control testing
    DKrapohl Guest

Similar Threads

  1. operator
    By Gyger in forum PHP Development
    Replies: 3
    Last Post: August 18th, 07:18 AM
  2. The >> operator
    By Gohaku in forum PERL Beginners
    Replies: 5
    Last Post: May 30th, 02:50 AM
  3. XOR operator?
    By Daniel Carrera in forum Ruby
    Replies: 9
    Last Post: October 29th, 12:16 AM
  4. or operator
    By Paul Kraus in forum PERL Beginners
    Replies: 0
    Last Post: August 29th, 05:58 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139