mike2145
October 9th, 2001, 12:08 PM
In foxpro you can determine how many array Vars are actually populated ie:{ alen() }
what do you use in vb6 ???
what do you use in vb6 ???
|
Click to See Complete Forum and Search --> : alen() mike2145 October 9th, 2001, 12:08 PM In foxpro you can determine how many array Vars are actually populated ie:{ alen() } what do you use in vb6 ??? Iouri October 9th, 2001, 12:21 PM UBound Iouri Boutchkine iouri@hotsheet.com mike2145 October 9th, 2001, 02:01 PM No Ubound just reports the total max array not say for example you only have 7 out of the possible 128 array vars loaded with a value..In foxpro if you ask for alen(array) it reports just whats loaded with vars ??? I need some way to determine the number of array places actually loaded with info not the total of the array as in the dim y(128) DSJ October 9th, 2001, 03:01 PM I think you're going to have to count them yourself with a For... Next loop. srinika October 9th, 2001, 09:48 PM Better if u define the array as a dynamic array -MyArray()- and using ReDim and ReDim Preserve when array is added with new elements. This way is more memory efficient and ur problem can be solved by means of using UBound Srinika snong October 10th, 2001, 01:30 AM If you use like this: dim myArray as variant myarray = rs.GetRows(i) you can use Ubound(myarray) to determine the real data number in array,just be careful when ubound(myarray) return 0, it also may be no data returned. If you use array manually, you redim it yourself and operate on it, I think you may need to add a variable with it to record the number of data you store in the array. Hope to be helpful. Happy to be a programmer. Cimperiali October 10th, 2001, 03:58 AM Dsj and snong are right: There is not a function n Vb that will tell you how many cells of array are effectively full of data. If you retrive records with getrows, you will have a bidimensional array as big as the total of records, not the total of records with data (which may be lower). You will have to implement a for...next loop to search for filled cells.... Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus. The Rater codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |