我正在处理这个项目,我在列表框中有 IP 地址,并且我已经获得了一种将列表框项目传输到文本框的方法,但我需要通过按钮更改 IP 地址。
例如,我有这三个 IP 地址:
- 123.456.78
- 891.23.45.6
- 789.123.12
文本框中的当前 IP 地址是 123.456.78,但是当我单击一个按钮时,它也更改了第二行,即 891.23.45.6,它只能是文本框中的那个(不像 123.456.78 被推到一边)。
这就是我需要的代码。
它全部放在一个按钮下,例如 -
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'*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/somethingOrOther")
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))
End Sub
有人可以帮我吗?