Hi,
I have tried lots but i would like the listbox1.selected index to go through each single one
i tried +1 it works but it wont go the next one
Please help cheers
For i As Integer = 0 To ListBox1.Items.Count-1
ListBox1.SelectedIndex = i
Next
Works but it does it too fast is there anyway to make it go slower so you can see it visually also?
use timer
If i < ListBox1.Items.Count - 1 Then
i = i + 1
ListBox1.SelectedIndex = i
End If
and write this code inside the timer1_tick event
Im a real noob when it comes to timer i actually hate them please explain
so i should put under button 1 timer.1 start where do i put timer stop ect
Cheers
says i is not declared i know why but not sure how to fix
add the timer control to your form by double clicking on the tool bar
when timer is added into your form just double on it and paste the code
and declare this variable globally
dim i as integer=0
and
timer1.enable=true
paste this line on form_load event
Enable is not part of the timer error you mean start or what?
Cheers
Timer1.Enabled = True
Yes i mean to start its enabled ok
it does not even move?
Dim i As Integer = 0
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If i < ListBox1.Items.Count - 1 Then
i = i + 1
ListBox1.SelectedIndex = i
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
End Sub
Check this.
If this work then ok, other wise post your updated code with you problem in very clear manner, other it take long time to get solution for your problem
Public Class Form1
Dim dir As String
Dim i As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
OpenFileDialog1.Title = "Please Select a File"
'OpenFileDialog1.InitialDirectory = "C:temp"
OpenFileDialog1.ShowDialog()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("http://pingomatic.com/")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.Document.GetElementById("title").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.GetElementById("blogurl").SetAttribute("value", TextBox2.Text)
WebBrowser1.Navigate("javascript:check_common();")
WebBrowser1.Navigate("javascript:document.getElementById('pingform').submit();")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox2.Text = (ListBox1.SelectedItem)
Label3.Text = "Url: " & ListBox1.SelectedItem
Timer1.Start()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
OpenFileDialog1.Title = "Please Select a File"
'OpenFileDialog1.InitialDirectory = "C:temp"
OpenFileDialog1.ShowDialog()
End Sub
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
Dim strm As System.IO.Stream
strm = OpenFileDialog1.OpenFile()
Dir = OpenFileDialog1.FileName.ToString()
If Not (strm Is Nothing) Then
'insert code to read the file data
strm.Close()
End If
Me.ListBox1.DataSource = IO.File.ReadAllLines(Dir)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If i < ListBox1.Items.Count - 1 Then
i = i + 1
ListBox1.SelectedIndex = i
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
End Sub
End Class
Heres my code
i want it to go through each one so that each site will be pinged
Public Class Form1
Dim dir As String
Dim i As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
OpenFileDialog1.Title = "Please Select a File"
'OpenFileDialog1.InitialDirectory = "C:temp"
OpenFileDialog1.ShowDialog()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("http://pingomatic.com/")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.Document.GetElementById("title").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.GetElementById("blogurl").SetAttribute("value", TextBox2.Text)
WebBrowser1.Navigate("javascript<b></b>:check_common();")
WebBrowser1.Navigate("javascript<b></b>:document.getElementById('pingform').submit();")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Timer1.Start()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
OpenFileDialog1.Title = "Please Select a File"
'OpenFileDialog1.InitialDirectory = "C:temp"
OpenFileDialog1.ShowDialog()
End Sub
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
Dim strm As System.IO.Stream
strm = OpenFileDialog1.OpenFile()
Dir = OpenFileDialog1.FileName.ToString()
If Not (strm Is Nothing) Then
'insert code to read the file data
strm.Close()
End If
Me.ListBox1.DataSource = IO.File.ReadAllLines(Dir)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If i < ListBox1.Items.Count - 1 Then
i = i + 1
ListBox1.SelectedIndex = i
TextBox2.Text = (ListBox1.SelectedItem)
Label3.Text = "Url: " & ListBox1.SelectedItem
End If
End Sub
End Class
Wish you better luck
Dim x As Integer = 0
Dim j As Integer = 0
For i As Integer = 0 To ListBox1.Items.Count - 1
For j = 0 To 50
j = j + 1
If j < 50 Then
Application.DoEvents()
End If
Next
ListBox1.SelectedIndex = i
MsgBox(ListBox1.SelectedIndex.ToString)
Next
I cant seem to get the post before the other one to work
i just want it to go through and ping the selected websites in the list
Thats a different problem.......so you have to start new thread to get better help actually i never do programming related to web.
I cant seem to get the post before the other one to work
i just want it to go through and ping the selected websites in the list
Just wondering, each site that you load and ping in the WebBrowser, does it load a new page that you need to view/get confirmation before it moves on to try and ping another site?
Yes it does
Since you already have most of the info in this thread to accomplish your goal, I will send you a private message and help you organize the code already provide to get you a solution. Reason is, kind of pointless to overload a permanent thread with similar info and private messages can be deleted.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.