mac_shinobi Posted August 10, 2009 Posted August 10, 2009 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cboAddProxy.Items.Clear() Dim strFile, output strFile = "ProxyServers.txt" output = Strings.Left(Application.ExecutablePath, Strings.InStrRev(Application.ExecutablePath, "\")) & strFile Dim fileText As String = Strings.Trim(My.Computer.FileSystem.ReadAllText(output)) Dim arr() As String = fileText.Split(vbNewLine) For Each x In arr cboAddProxy.Items.Add(Strings.Trim(x.ToString)) Next End Sub How do I get rid of the vbNewLine characters
DrPerceptron Posted August 10, 2009 Posted August 10, 2009 Hazarding a guess that line 7 is the line to edit, but I don't know what you want to replace it with. Dim arr() As String = fileText.Split(vbNewLine) vbNewLine -> "," or whatever else you want. http://www.homeandlearn.co.uk/net/nets7p7.html 1
mac_shinobi Posted August 10, 2009 Author Posted August 10, 2009 Hazarding a guess that line 7 is the line to edit, but I don't know what you want to replace it with. Dim arr() As String = fileText.Split(vbNewLine)vbNewLine -> "," or whatever else you want. Visual Basic .NET programming for Beginners - How to use Split() and Join() Did that and it didnt work - finally got it working ammended code below in bold Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cboAddProxy.Items.Clear() Dim strFile, output strFile = "ProxyServers.txt" output = Strings.Left(Application.ExecutablePath, Strings.InStrRev(Application.ExecutablePath, "\")) & strFile Dim fileText As String = Strings.Trim(My.Computer.FileSystem.ReadAllText(output)) [b] Dim arr() As String = Microsoft.VisualBasic.Strings.Split(fileText, vbNewLine)[/b] '= fileText.Split(vbNewLine) For Each x In arr If x.ToString = vbNullString Then Else [b]cboAddProxy.Items.Add(Strings.Trim(x.ToString))[/b] End If Next End Sub
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now