473,378 Members | 1,420 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,378 software developers and data experts.

loop help please

82
I'm trying to shorten this list

Page01.Visible = False
Page02.Visible = False
Page03.Visible = False
Page04.Visible = False
Page05.Visible = False
...
Page50.Visible = False

(there are 50 entries in the list)

I have tried writing a for to loop but I am stuck. I have got this far

Dim i As Integer

For i = 1 To 50
Page(i).Visible = False
Next

now I get an error message sayin "expression is not a method or array....."
Can somebody show me what the loop should be please.

mrcw
Dec 1 '08 #1
4 1527
debasisdas
8,127 Expert 4TB
The error message is self explanatory. Why you need a loop for that. A simple sub-procedure will do all that for you.
Dec 1 '08 #2
smartchap
236 100+
May try this:

Dim j as string
for i=1 to 50
j=Page & i
j.Visible=False
next
Dec 2 '08 #3
mrcw
82
Thanks for your suggestion Smartchap but it doesn't work.
mrcw
Dec 2 '08 #4
@mrcw

If you really want to do in this way you need to make the names the same.

For any language Page1 is different from Page01.

Taking the example of Smarchap you can do some changes on it.

Dim j as string
Dim myCtrl as new Object

for i=1 to 50
j="Page" & i.tostring("00")

myCtrl.Name = j

myCtrl.Visible=False

next


Try this and let us know if worked.


Rpicilli
Dec 2 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: !TG | last post by:
I currently use Do while loop, but I'd rather use a For Loop though I have never gotten the hang of them. Would some one please be so kind as to show me how to loop through a recordset.
7
by: JR | last post by:
Hey all, I have read part seven of the FAQ and searched for an answer but can not seem to find one. I am trying to do the all too common verify the data type with CIN. The code from the FAQ...
3
by: deko | last post by:
Problem: why doesn't this With block work? is it possible to have a For Each loop within a With block? With objWord .Documents.Add Template:=strTemplate, NewTemplate:=False, DocumentType:=0...
3
by: Ben R. | last post by:
In an article I was reading (http://www.ftponline.com/vsm/2005_06/magazine/columns/desktopdeveloper/), I read the following: "The ending condition of a VB.NET for loop is evaluated only once,...
4
by: Byte | last post by:
The following code will not work for me: x = 1 while x == 1: print 'hello' x = input('What is x now?: ') while x == 2: print 'hello again'
14
by: dba_222 | last post by:
Dear experts, Again, sorry to bother you again with such a seemingly dumb question, but I'm having some really mysterious results here. ie. Create procedure the_test As
3
by: Camel | last post by:
I am very new to C++ and came across this section of code in an example, whilst learning about dynamic memory. The example uses the delete operator in a for loop, it seems to imply that each time...
5
by: GeekBoy | last post by:
Thanks for the help obnoxious. Reading in the rest of the line with "getline" worked great and now the averages work. Now for the new problem. Program on first run works flawlessly. Next runs...
5
by: justbovo | last post by:
Hello, My name is Justin. I am working on a part of a Find Memory module for a program. Here's how it works.. I enter '13' at the main menu which branches out to my Find Memory module. I ask...
4
by: chellemybelle | last post by:
Hello, I basically have made a little cheezy slideshow and would like to add captions to each pic as it loops through. I've tried everything I can think of. I'm assuming I might need to use an...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.