473,387 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

View variable values

Is it possible, for learning purposes, to show the values of an array?
Something like:
arMyArray.view()?

I tried MsgBox (arMyArray) but that (obviously) doesn't work.
Thanks,
john
Sep 14 '06 #1
4 5451
Think of an Array as a list with sequential indexes - starting at 0.

Dim arr(2) As String
arr(0) = "a"
arr(1) = "b"
arr2() = "c"

You have to loop through the array to get the values that are stored in
the array:

Dim i As Integer, str1 As String
For i = 0 to Ubound(arr)
str1 = str1 & arr(i) & ", "
Next
MsgBox str1

Now the MsgBox will display all the values in arr.

Note: Ubound is a built-in function that gets the upper value of an
array. I could have just said
For i = 0 to 2

But it is good practice to use Ubound for when you use dynamic arrays
where you don't really know the upper value ahead of time. For dynamic
arrays you increment them using
Redim Preserve. This is all in the help files.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Sep 14 '06 #2
john wrote:
Is it possible, for learning purposes, to show the values of an array?
Something like:
arMyArray.view()?

I tried MsgBox (arMyArray) but that (obviously) doesn't work.
Thanks,
john
In addition to what Rich P explained, you could also set a break point
in your code, then select View|Locals to see the contents of your array
(as well as other variables and such).
--
Smartin
Sep 14 '06 #3
Thanks,
Sometimes it's hard to find another app's functionality equivalent in
access. In Paradox ar.view() shows the contents of the array in a little
srollable form.
john

<<It's easy to find your socks if you know in which drawer they are ;-)>>

"Rich P" <rp*****@aol.comschreef in bericht
news:45***********************@news.qwest.net...
Think of an Array as a list with sequential indexes - starting at 0.

Dim arr(2) As String
arr(0) = "a"
arr(1) = "b"
arr2() = "c"

You have to loop through the array to get the values that are stored in
the array:

Dim i As Integer, str1 As String
For i = 0 to Ubound(arr)
str1 = str1 & arr(i) & ", "
Next
MsgBox str1

Now the MsgBox will display all the values in arr.

Note: Ubound is a built-in function that gets the upper value of an
array. I could have just said
For i = 0 to 2

But it is good practice to use Ubound for when you use dynamic arrays
where you don't really know the upper value ahead of time. For dynamic
arrays you increment them using
Redim Preserve. This is all in the help files.

Rich

*** Sent via Developersdex http://www.developersdex.com ***

Sep 15 '06 #4
On Fri, 15 Sep 2006 07:29:00 +0200, "john" <jo**@test.comwrote:

Nothing built in, but nothing stops you from writing your own function
that takes an array and writes it to a MsgBox or the Debug window.

-Tom.

>Thanks,
Sometimes it's hard to find another app's functionality equivalent in
access. In Paradox ar.view() shows the contents of the array in a little
srollable form.
john

<<It's easy to find your socks if you know in which drawer they are ;-)>>

"Rich P" <rp*****@aol.comschreef in bericht
news:45***********************@news.qwest.net.. .
>Think of an Array as a list with sequential indexes - starting at 0.

Dim arr(2) As String
arr(0) = "a"
arr(1) = "b"
arr2() = "c"

You have to loop through the array to get the values that are stored in
the array:

Dim i As Integer, str1 As String
For i = 0 to Ubound(arr)
str1 = str1 & arr(i) & ", "
Next
MsgBox str1

Now the MsgBox will display all the values in arr.

Note: Ubound is a built-in function that gets the upper value of an
array. I could have just said
For i = 0 to 2

But it is good practice to use Ubound for when you use dynamic arrays
where you don't really know the upper value ahead of time. For dynamic
arrays you increment them using
Redim Preserve. This is all in the help files.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Sep 15 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Droolboy | last post by:
I'm trying to build a fairly small (max. 10 different pages) site using php, and it's becoming obvious that I need some kind of model view separation. Having done a few searches, I've come...
2
by: Hennie de Nooijer | last post by:
Because of an error in google or underlying site i can reply on my own issue. Therefore i copied the former entered message in this message....
3
by: brendan_gallagher_2001 | last post by:
Hi, I have a view(A) and I am trying to do a join on another table (B) to include only rows where date values in view A is greater than in table B. I also want the view to pick up rows in viewA...
4
by: stacdab | last post by:
We have a partitioned view with 4 underlying tables. The view and each of the underlying tables are in seperate databases on the same server. Inserts and deletes on the view work fine. We then...
5
by: Antoni Massó Mola | last post by:
I have a form that sends data to another .aspx page. In the second .aspx I have this code to retrieve the form's values and create sessions: Application("Login") = Request.Form("txtLogin")...
3
by: V T | last post by:
Hello all, SQL Server 2000 documentation http://www.microsoft.com/technet/prodtechnol/sql/2000/reskit/part10/c3761.mspx states that if view is using "NOT NULL" columns of a base table, then...
1
by: Matik | last post by:
Hey, First, sorry if this post appear twice, because, I can not find my post recently send, trying to post it once again. I'm out of ideas, so, I thought, will search help here again :( I'm...
12
by: brwalias | last post by:
Hi, using .net 2 sql server 2005 Here is my situation: I'm passing a variable in the url from a selection on Page A and need to display the results on the Results page be based on that...
3
by: mckbill | last post by:
Is there a way I can direct the cursor to a specific field (variable) in a form by typing the field name while in form view? I have a form with many fields, and it would be nice if there were...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.