Link to home
Start Free TrialLog in
Avatar of suvmitra
suvmitraFlag for India

asked on

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.


Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

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
Avatar of suvmitra

ASKER

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.
Does you container hold a property url ?
What exactly is your container ? Is it a webbrowser ?
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
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

In VB 6 there is no listbox..instead List1.

This is not working.

Please help.
ASKER CERTIFIED SOLUTION
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

Can you please upload your VB 6 project? I am getting compile error...for List1.list and list1.listcount. Thank you.
Sorry..no compile error..this is working fine. Thank you.
Sorry..no compile error this is working fine..thank you.