how can change the LeftMost dimension of an array
-
hi all i want to change the leftmost dimension of a two - dimensional array. but redim statement does not change the Left Most dimension. For example i declare a two-dimensional array as following
Dim WrappingItemInfo(0, 4) As String
after that i write following statement at particular conditionReDim Preserve WrappingItemInfo(1, 4)
but above statement give error "'ReDim' can only change the rightmost dimension.". so how can i change the leftmost dimension of an array ?Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India) My Company
-
hi all i want to change the leftmost dimension of a two - dimensional array. but redim statement does not change the Left Most dimension. For example i declare a two-dimensional array as following
Dim WrappingItemInfo(0, 4) As String
after that i write following statement at particular conditionReDim Preserve WrappingItemInfo(1, 4)
but above statement give error "'ReDim' can only change the rightmost dimension.". so how can i change the leftmost dimension of an array ?Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India) My Company
set WrappingItemInfo(1) to be a new array of four elements. This would work in C#, should work in VB.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
set WrappingItemInfo(1) to be a new array of four elements. This would work in C#, should work in VB.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
sir, thanks for your response but i does not properly get you can you explain it bit more with code(whether in c# or vb) one more thing. in my previous post, i simply give a example. In real condition, Leftmost dimension of an array is increased every time by one when a particular condition is found.
Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India) My Company
-
sir, thanks for your response but i does not properly get you can you explain it bit more with code(whether in c# or vb) one more thing. in my previous post, i simply give a example. In real condition, Leftmost dimension of an array is increased every time by one when a particular condition is found.
Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India) My Company
int [,] n = new int[5,5](); n[0] = new int[5](); something like that
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
sir, thanks for your response but i does not properly get you can you explain it bit more with code(whether in c# or vb) one more thing. in my previous post, i simply give a example. In real condition, Leftmost dimension of an array is increased every time by one when a particular condition is found.
Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India) My Company
You should use a dynamic collection instead of an array, like a List(Of String()). An array can't be resized, so what the ReDim command does is to create a new array, and copy all data from the old array to the new array. It can get pretty expensive as the array grows...
Despite everything, the person most likely to be fooling you next is yourself.