|
-
Jul 10th, 2006, 07:48 AM
#1
Thread Starter
New Member
moving to the next array?
Hi All,
I am still new to VB, so I need a little help please. I am trying to move to the next array in the below code. i know its very simple, but once the "clickbutton" check has been completed for varArray(0) , how do i move to varArray(1)?
Any help would be grateful.
Thanks.
Dim varArray(0 To 1) As Variant
varArray(0) = "http://www.bbc.co.uk"
varArray(1) = "http://www.vbforum..com"
GoToPage (varArray(0))
ClickButton ""
If ClickButton = True Then
WriteToLog "button found"
End If
End Sub
-
Jul 10th, 2006, 08:11 AM
#2
Re: moving to the next array?
im not sure what your trying to do...
but just go to the next one?
GoToPage (varArray(1))
ClickButton ""
If ClickButton = True Then
WriteToLog "button found"
End If
for you could use a loop
VB Code:
For x = 0 to 1 ' or if u dont know how many are in your array
'For x = 0 to ubound(varArray)
GoToPage (varArray(x))
ClickButton ""
If ClickButton = True Then
WriteToLog "button found"
End If
Next
this will do wach one in the array
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 10th, 2006, 05:18 PM
#3
Re: moving to the next array?
VB Code:
ClickButton ""
If ClickButton = True Then
Either ClickButton is something that can hold a string or it's something that returns a boolean.
Are you referring to a button being clicked? Or is ClickButton a function that accepts a string parameter and returns a boolean (in which case, due to the way you use it, your executable is going to be overly complex)?
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jul 10th, 2006, 07:48 PM
#4
Re: moving to the next array?
Along Statics example, but using a Static variable.
Each subsiquant click of the button, increases the Array Index.
Beter yet, use a Form level (global) variable Dimmed (not Static) so you have the
ability to re-set it as required.
Pseudo:
VB Code:
Option Explicit
Dim varArray(0 To 1) As Variant
Dim intIdx As Integer
Private Sub Form_Load()
varArray(0) = "http://www.bbc.co.uk"
varArray(1) = "http://www.vbforum..com"
'more?
intIdx = 0
End Sub
Private Sub Command1_Click()
GoToPage (varArray(intIdx))
ClickButton ""
If ClickButton = True Then
WriteToLog "button found"
'Code.....
intIdx = intIdx + 1
End Sub
Private Sub cmdReset_Click()
intIdx = 0
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|