Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xarray help please

Status
Not open for further replies.

griffitd

Programmer
Aug 20, 2002
189
GB
Hi

Can anyone tell me what the command is to view the contents of an xarray in the vb6 immediate window?

Thanks
 

What I do is:
Code:
Dim ary(5) As String
Dim i As Integer

For i = 0 To UBound(ary)
    ary(i) = i * 2.5
Next i

For i = 0 To UBound(ary)
    [blue]Debug.Print "ary(" & i & ") = " & ary(i)[/blue]
Next i
and in immediate window I have:
[tt]
ary(0) = 0
ary(1) = 2.5
ary(2) = 5
ary(3) = 7.5
ary(4) = 10
ary(5) = 12.5[/tt]

Have fun.

---- Andy
 
Thanks

I have used a commandwhere you type

command NAMEOFARRAY

and it displays the whole array for you.

Thanks
 
I am fond of using watches for this.

When you are running your app in the VB IDE, you can right click on your array, and then click "Add Watch". You will see that a "Watches" window will open up with your array variable listed. Since it is an array, there will be a plus sign next to it (to the left). click the plus and you will see all the values.

I should mention that this method works for complicated arrays, too. In my project, I have many user defined data types, and arrays of them, and arrays of arrays of arrays, etc.... The watches window allows me to see the whole thing.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
This doesn't work with the xarray. I know theres a command i just dont know what it is.
 
My fault I guess. When I saw xarray in your original post, I thought it was a typo for plain ole' array. Honestly, I don't know what xarray is. I'm guessing it's an object of some sort.

I try not to guess or make too many assumptions when I answer questions. I guess I failed this time. Sorry about that.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
no worries.
Its the Xarray of a True bound data grid object.
 
It may be a deficiency in my VB skills (definite possibility) but you seem to be referring to "xarray" as something distinct from the sort of arrays that Andrzejek and gmmastros have illustrated.

What is "xarray" as you are using the term and, if it isn't a garden-variety array, how are you constructing it?
 
And if you haven't thought ahead to include the debug.print statements in your code, you can still get at the values easily in the immediate window. Based on Andy's example, like this:
Code:
For i = 0 To UBound(ary) : ? "ary(" & i & ") = " & ary(i) : Next i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top