Reputation: 0 Apprentice
- New Members
- Active Posts:
- 5 (0.01 per day)
- 06-October 12
- Profile Views:
- Last Active:
- Oct 06 2012 08:24 AM
- Dream Kudos:
Posts I've Made
Posted 6 Oct 2012To switch to a new item after every seconds, use this code:
For i As Integer = 0 To ListBox1.Items.Count - 1 Step 1 ListBox1.SelectedIndex = i Thread.Sleep(5000) ' Wait for 5 seconds Next
You can offcourse run that code inside a different thread. Or modify it to a infinite loop that sets index back to 0 when the current index is the last item
Posted 6 Oct 2012Oh , I left that part out.
So can you supply it?
Look what I'm saying is: Let's say you have the following in your listbox
Now lets suppose you clicked on the first item of the listbox
You can set the textbox1.text = listbox1.selecteditem
now textbox1.text holds the SAME thing that is selected in listbox1 (because you filled in with a list of strings)
Now lets say you want to use that value
Messagebox.Show("My Textbox Shows:" & TextBox1.Text)
would result in a messagebox that reads: My Textbox Shows: 123.456.789.012
But, let's decide that we didn't use the textbox but instead used the selecteditem of the listbox
Messagebox.Show("I selected in my list: " & ListBox1.SelectedItem
would result in a messagebox that reads: I selected in my list: 123.456.789.012
As you can see both results are the same because all you did in the textbox was copy a string of a selected item to a string in a textbox to use as a string in something else.
All I'm pointing out is you're just using two different ways of displaying a string to get a string when you could have just taken it straight from the source. (in this case the ListBox)
That all made perfect sense , but I wan't the listbox to switch to a new item after like every x.x.x seconds.
Posted 6 Oct 2012OK, so where is the code where you're putting the selecteditem of the listbox into the textbox as you described above?
Also, why do you need it to go to a textbox? are you going to use the contents of that textbox in something? If you need the textbox to be what is hilighted in the listbox, why not just use the selecteditem of the listbox to get that value to use in something.
Oh , I left that part out. And yes I will be using the textbox for something , I need each IP to be switched with a timer in the textbox through the value of the listbox. I just need the listbox to be able to update my IPs.
Posted 6 Oct 2012Can we see the line where you're putting the item from the listbox into the textbox. It sounds like you're performing a concatenation. If you set the text property = something that is what the text property holds. If you are concatenating the text property, it will add to what is there.
Let's see where you're setting the text property of the textbox.
Ok , well this is all in one button.
'*Grabbing our proxy text from our online server (this way we can keep updating our proxies). Dim Str As System.IO.Stream Dim srRead As System.IO.StreamReader Try ' make a Web request Dim req As System.Net.WebRequest = System.Net.WebRequest.Create("https://dl.dropbox.com/u/100659925/ProxiesPortAlways8080.txt") Dim resp As System.Net.WebResponse = req.GetResponse Str = resp.GetResponseStream srRead = New System.IO.StreamReader(Str) ' read all the text TextBox2.Text = srRead.ReadToEnd Catch ex As Exception TextBox2.Text = "Unable to download content" Finally ' Close Stream and StreamReader when done srRead.Close() Str.Close() End Try ' Assign string to reference. Dim value1 As String = TextBox2.Text ' Replace word with another word. Dim value2 As String = value1.Replace("<br>", vbNewLine) TextBox2.Text = value2 ListBox1.Items.Add(TextBox2.Text) '*Now , we're taking our fresh proxies in the textbox and moving them into our listbox. ListBox1.Items.AddRange(TextBox2.Text.Split(vbNewLine))
- Member Title:
- New D.I.C Head
- Age Unknown
- Birthday Unknown
Nasss hasn't added any friends yet.