Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > 'ReDim Preserve' problem


Reply
 
Thread Tools Display Modes
  #1  
Old 02-12-2004, 06:17 AM
natrajv's Avatar
natrajv natrajv is offline
Centurion
 
Join Date: Sep 2003
Posts: 163
Default 'ReDim Preserve' problem


ReDim Preserve not working for Two-dimensional

Dim aa() as Integer
ReDim aa(3,4) '--No error
ReDim aa(4,4) '--No error
'--Following statement raises error
'--Subscript out of range
ReDim Preserve aa(5,4)

I have no clue why it is happening only when I use
ReDim Preserve and not ReDim...

Any help?
Reply With Quote
  #2  
Old 02-12-2004, 06:18 AM
Squirm's Avatar
Squirm Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

You can only resize the last dimension of a dynamic array when specifying Preserve.

This is all explained in your MSDN library.
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #3  
Old 02-12-2004, 06:20 AM
natrajv's Avatar
natrajv natrajv is offline
Centurion
 
Join Date: Sep 2003
Posts: 163
Default

Quote:
Originally Posted by Squirm
You can only resize the last dimension of a dynamic array.



Thanks... but, it works for ReDim and not for ReDim Preserve. Why this preculiar behaviour.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Redim Preserve doesn's work?!?! Masterwiz General 3 12-22-2003 01:19 PM
Redim Preserve Statement... Rookie General 1 09-25-2003 12:15 AM
ReDim Preserve (subscript out of range) Virgo Game Programming 4 11-18-2002 04:43 PM
Redim Preserve Problems davie General 7 09-12-2002 06:19 AM
Using Redim Preserve to change first dimension ezyeric General 1 10-02-2001 11:17 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->