By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,109 Members | 1,007 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,109 IT Pros & Developers. It's quick & easy.

Please guide me

P: 3
Dear friends , hi

I have text file with name "transPri.txt" that contains
something records like "1234324;234556090;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 "1234324234556090987654".//

best regards
Feb 5 '08 #1
Share this Question
Share on Google+
3 Replies


jamesd0142
100+
P: 469
Dear friends , hi

I have text file with name "transPri.txt" that contains
something records like "1234324;234556090;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 "1234324234556090987654".//

best regards

Read the whole file into a text box or veriable and process it in vb...
Feb 5 '08 #2

debasisdas
Expert 5K+
P: 8,127
I think it is a home work / assignment job.

What you have done so far ?
Feb 5 '08 #3

jamesd0142
100+
P: 469
Here's an example.. work with it and it will solve your problem

Expand|Select|Wrap|Line Numbers
  1.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim abc As String
  3.         TextBox1.Text = Readfile(abc)
  4.         For i As Integer = 1 To Len(TextBox1.Text)
  5.             Dim a As String = Mid(TextBox1.Text, i, 1)
  6.             If a <> ";" Then
  7.                 TextBox2.Text += a
  8.             End If
  9.         Next
  10.     End Sub
  11.     Function Readfile(ByVal abc)
  12.         Dim EntireLine As String
  13.         Dim oFile As System.IO.File
  14.         Dim oRead As System.IO.StreamReader
  15.         oRead = oFile.OpenText("c:\temp\abc.txt")
  16.         EntireLine = oRead.ReadToEnd
  17.         oRead.Close() 'test line
  18.         Return EntireLine
  19.     End Function
  20.  
Feb 5 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.