+ Post New Thread
Results 1 to 3 of 3
Coding Thread, vb 2008 in Coding and Web Development; Code: 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" ...
  1. #1

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    10,053
    Thank Post
    3,585
    Thanked 1,123 Times in 1,025 Posts
    Rep Power
    377

    vb 2008

    Code:
        
    
    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

  2. #2
    DrPerceptron's Avatar
    Join Date
    Dec 2008
    Location
    In a house
    Posts
    932
    Thank Post
    37
    Thanked 135 Times in 115 Posts
    Rep Power
    42
    Hazarding a guess that line 7 is the line to edit, but I don't know what you want to replace it with.

    Code:
    Dim arr() As String = fileText.Split(vbNewLine)
    vbNewLine -> "," or whatever else you want.

    http://www.homeandlearn.co.uk/net/nets7p7.html

  3. Thanks to DrPerceptron from:

    mac_shinobi (10th August 2009)

  4. #3

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    10,053
    Thank Post
    3,585
    Thanked 1,123 Times in 1,025 Posts
    Rep Power
    377
    Quote Originally Posted by DrPerceptron View Post
    Hazarding a guess that line 7 is the line to edit, but I don't know what you want to replace it with.

    Code:
    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

    Code:
        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 = Microsoft.VisualBasic.Strings.Split(fileText, vbNewLine) '= fileText.Split(vbNewLine)
    
            For Each x In arr
                If x.ToString = vbNullString Then
    
                Else
                    cboAddProxy.Items.Add(Strings.Trim(x.ToString))
                End If
            Next
        End Sub



SHARE:
+ Post New Thread

Similar Threads

  1. Moodle / Server 2008 / IIS7 / MS SQL Server 2008 Express
    By Kamran7860 in forum Virtual Learning Platforms
    Replies: 3
    Last Post: 23rd November 2010, 07:03 AM
  2. Server 2008 R2 RC & Ms Hyper-V Server 2008 R2 Beta
    By Kamran7860 in forum Windows Server 2008 R2
    Replies: 4
    Last Post: 12th May 2009, 07:04 PM
  3. Replies: 1
    Last Post: 5th May 2009, 03:17 PM
  4. 2003 DC & Exchange to 2008 DC and 2008 Exchange
    By Nick_Parker in forum Windows Server 2008
    Replies: 3
    Last Post: 31st December 2008, 07:57 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •