Results 1 to 3 of 3

Thread: Dim numbers ?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2015
    Posts
    9

    Dim numbers ?

    Hello vbforums. I've been making string cipher/encoders for quite some time but i've never had to dim a number. Does anyone know how i can do that ?


    What im trying to do:
    Code:
    Dim 1 as String
    What error im getting:
    Code:
    "Identifier expected."

    // Andreas Digmann

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,754

    Re: Dim numbers ?

    In Visual Basic.Net, in order to declare a variable it must start with either an underscore or a letter followed by letters, numbers, and underscores(or nothing else if it starts with a letter).

    Something else, if you're declaring a number then you should set the data type as a numeric data type such as an Integer, Double, Decimal, Short, etc. rather than a String because a String basically represents Text. So change your code to something like this:
    Code:
    Dim _1 as Integer = 1
    'Or
    Dim one As Integer = 1
    Edit - Here is a list of data types offered in VB.Net: https://msdn.microsoft.com/en-us/library/47zceaw7.aspx
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2015
    Posts
    9

    Re: Dim numbers ?

    Thanks 'dday9' - Hope it will work, hahaha i tried to whipe the bug off my screen.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width