List box Loop

Hi,

I am doing a project into Visual Basic 6.0.

I am populate 50 items (URLs) into a list box at the Form Load event. Now, I want to do the following when the Time1 is enabled.

A loop which will rotate the list box urls and display those into webbrowser1..in a 30 sec interval. When all 50 urls are complete the loop will stop and the Timer will Stop.

Please help.


LVL 9
suvmitraAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DhaestCommented:
stick a timer and a label on the form the code is
Dim index as int
Private Sub Form_Load()
     Timer1.Interval = 18000
     index = 0
End Sub

Private Sub Timer1_Timer()
     OpenURL(listbox(index))
End Sub

Public Sub OpenURL(iURL As String)
On Error Resume Next

Dim Temp As Object

'Create instance
Set Temp = CreateObject("InternetExplorer.Application")

'Open URL
Temp.Navigate2 iURL
Temp.Visible = True
End Sub
0
suvmitraAuthor Commented:
Thank you Dhaest! But I have already designed a Container for displaying the urls that is Webbrowser1.
I want to display those urls only into webbrowser1.
Please help.
0
DhaestCommented:
Does you container hold a property url ?
What exactly is your container ? Is it a webbrowser ?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

suvmitraAuthor Commented:
If you have Visual Basic 6...in the reference there is a container called Microsoft Internet controls..if you drag that component into your Visual Basic Project ..select it and drop it into the Form1..it will show you as webbrowser1.
 
And you declare at the form load event as
WebBrowser1.Navigate (http://indiangeekforum.info/)
 
And also

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
On Error Resume Next
Form1.Caption = (WebBrowser1.LocationName)
End Sub
 
And also
Sub SelectMe()
On Error Resume Next
If Text2.Text = 1 Then
WebBrowser1.Navigate ("http://indiangeekforum.info/MyApps.html")
Text3.Text = 0.0001
ElseIf Text2.Text = 2 Then
WebBrowser1.Navigate ("http://indiangeekforum.info/Hacks.html")
Text3.Text = Text3.Text + 0.0001
end sub
0
DhaestCommented:
In that case
Dim index as int
Private Sub Form_Load()
     Timer1.Interval = 18000
     index = 0
     Timer1.Enabled = true
End Sub
 
Private Sub Timer1_Timer()
     WebBrowser1.Navigate (listbox(index)
     index = index + 1
     if index = 50 then
           Timer1.Enabled = false
     end if
End Sub

Open in new window

0
suvmitraAuthor Commented:
In VB 6 there is no listbox..instead List1.

This is not working.

Please help.
0
DhaestCommented:
Just tested the code on a new project here (with only 2 links and change every 3 seconds)
Dim index As Integer
 
Private Sub Form_Load()
     Timer1.Interval = 3000
     index = 0
     Timer1.Enabled = True
End Sub
 
Private Sub Timer1_Timer()
     WebBrowser1.Navigate (List1.List(index))
     index = index + 1
     If index = 50 Or index = List1.ListCount Then
           Timer1.Enabled = False
     End If
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
suvmitraAuthor Commented:
Hi,

Can you please upload your VB 6 project? I am getting compile error...for List1.list and list1.listcount. Thank you.
0
suvmitraAuthor Commented:
Sorry..no compile error..this is working fine. Thank you.
0
suvmitraAuthor Commented:
Sorry..no compile error this is working fine..thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.