-
Need some help with Reading txt file and array
Hiya, im really new to vb.net and really need to finish this project. This should be simple to all you programmers and i apperciate your help.
So what i want to do is read from a .txt file. This file has loads of proxy IP addresses and is stored in this form, (as a list) :
xxx.xxx.xxx:xxxx
xxx.xxx.xxx:xxxx
xxx.xxx.xx:xxxx
xxx.xx.xxx:xxxx
i want to (using an array most probably) be able to select one proxy off the list in the txt file. I then want a variable that i can change so that i can hook it up to a timer so i can change the proxy every thirty seconds or so. (does not have to be random selection, what ever is easiest)
The underlined txt is what i need help with, i can do the rest myself, this is my code although it probably would be a good idea to start over because im un sure what i am doing
Public index As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim objreader As New System.IO.StreamReader(TextBox4.Text)
Dim proxylist As String
proxylist = objreader.ReadToEnd
Dim str As String
Dim strArr() As String
Dim time
Dim separators() As String
separators = {"\r\n"}
Str = proxylist
strArr = Str.Split(separators, StringSplitOptions.RemoveEmptyEntries)
index = strArr.Length - 1
TextBox1.Text = (strArr(index))
UseProxy(TextBox1.Text)
Form2.WebBrowser1.Navigate(TextBox3.Text)
TextBox5.Text = proxylist
What this does, is it displays all my proxys instead of just one 
I have asked for help on other websites, and people were not helpful, please dont tell me to use a vpn or something :P i just need help with this part of my project
-
Use a VPN.
Or, using separators=Environment.Newline may work depending on the formatting of the text file.
This method may also be useful: FileSystem.ReadAllText Method (String) (Microsoft.VisualBasic.FileIO)
You can also try the TextFieldParser Class (Microsoft.VisualBasic.FileIO) with a field width of zero.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks