Please guide me

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arsetoodeh
    New Member
    • Feb 2008
    • 3

    Please guide me

    Dear friends , hi

    I have text file with name "transPri.t xt" that contains
    something records like "1234324;234556 090;987654"
    in each line . I need a vb code that open the file and eliminate
    the ";" between fields and resave the file with the name "trans.dat"
    so the new file may be like "12343242345560 90987654".//

    best regards
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    #2
    Originally posted by arsetoodeh
    Dear friends , hi

    I have text file with name "transPri.t xt" that contains
    something records like "1234324;234556 090;987654"
    in each line . I need a vb code that open the file and eliminate
    the ";" between fields and resave the file with the name "trans.dat"
    so the new file may be like "12343242345560 90987654".//

    best regards

    Read the whole file into a text box or veriable and process it in vb...

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      I think it is a home work / assignment job.

      What you have done so far ?

      Comment

      • jamesd0142
        Contributor
        • Sep 2007
        • 471

        #4
        Here's an example.. work with it and it will solve your problem

        [code=vbnet]
        Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles Button1.Click
        Dim abc As String
        TextBox1.Text = Readfile(abc)
        For i As Integer = 1 To Len(TextBox1.Te xt)
        Dim a As String = Mid(TextBox1.Te xt, i, 1)
        If a <> ";" Then
        TextBox2.Text += a
        End If
        Next
        End Sub
        Function Readfile(ByVal abc)
        Dim EntireLine As String
        Dim oFile As System.IO.File
        Dim oRead As System.IO.Strea mReader
        oRead = oFile.OpenText( "c:\temp\abc.tx t")
        EntireLine = oRead.ReadToEnd
        oRead.Close() 'test line
        Return EntireLine
        End Function
        [/code]

        Comment

        Working...