Results 1 to 8 of 8

Thread: End of statement expected? [resolved]

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    End of statement expected? [resolved]

    If i put my mouse pointer of the "somestringvalue" part it shows a tooltip that says End of Statement Expected. What does this mean?

    Dim results(0,0,0) As String
    Dim index As Long

    redim preserve results(index,0,0) = "somestringvalue"
    Last edited by nkad; Jan 8th, 2005 at 12:18 AM.

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: End of statement expected?

    you can't assign a value to an element of the array on a redim statement..

    VB Code:
    1. Dim results(0,0,0) As String
    2. Dim index As Long
    3.  
    4. redim preserve results(index,0,0)
    5. results(index,0,0)  = "somestringvalue"

  3. #3
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: End of statement expected?

    Quote Originally Posted by kleinma
    you can't assign a value to an element of the array on a redim statement..

    VB Code:
    1. Dim results(0,0,0) As String
    2. Dim index As Long
    3.  
    4. redim preserve results(index,0,0)
    5. results(index,0,0)  = "somestringvalue"
    Surely you can only redim the final dimension if you use Preserve?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: End of statement expected?

    Thanks for reminding me.... Now what about this. In classic VB6 I could do multi-dimensional arrays. How do i do them in VB.NET?

    An unhandled exception of type 'System.ArrayTypeMismatchException' occurred in microsoft.visualbasic.dll

    Additional information: 'ReDim' can only change the rightmost dimension.

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: End of statement expected?

    Quote Originally Posted by taxes
    Surely you can only redim the final dimension if you use Preserve?
    yeah I think thats right... last dimention only

  6. #6
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: End of statement expected?

    Quote Originally Posted by nkad
    Thanks for reminding me.... Now what about this. In classic VB6 I could do multi-dimensional arrays. How do i do them in VB.NET?
    The example given IS a multi dimension array.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: End of statement expected?

    right, i know that. thx.

  8. #8
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: End of statement expected?

    Quote Originally Posted by nkad
    right, i know that. thx.

    Then what did you mean in your last question?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

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