Define a variable
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Define a variable

  1. #1
    Join Date
    Apr 2011
    Posts
    18

    Unhappy Define a variable

    WHat does this mean

    Dim variable(0,5) as Long

    later I'd use it as

    CoCreateInstance(variable(0),...)

    Someone could help me please ?
    Thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,981

    Re: Define a variable

    This means that each VAR has 0x5 (starting at 0, or 1x6) entries

    Code:
    Dim variable(0,5) as Long
    To use this:

    Code:
    Dim MyNum(1,5) as Long
    Dim x as Int, as Int
    for x=0 to 1
      for y=0 to 5
        print "X= &  x & " and Y="  & y
      next y
    next x
    it will print out

    X= 0 and Y= 0
    X= 0 and Y= 1
    X= 0 and Y= 2
    X= 0 and Y= 3
    X= 0 and Y= 4
    X= 0 and Y= 5
    X= 1 and Y= 0
    X= 1 and Y= 1
    X= 1 and Y= 2
    X= 1 and Y= 3
    X= 1 and Y= 4
    X= 1 and Y= 5
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    273

    Re: Define a variable

    Dglienna,

    In my learning period , Our teacher taught us something like this, we found it to be useless.
    But AFAI Remember he taught us the same thing which outputted a pyramid of * 's .
    Can you please refresh me once again the same?
    Rahul

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,981

    Re: Define a variable

    In my learning period , Our teacher taught us something like this, we found it to be useless.
    Then go back, and study my code again. You asked about an array, not building a string of "*"s

    If you built a matrix of "*"s (to form WORDS for instance) I'd be impressed
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center