| | |
how to delete the last line of the text file using c#
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2009
Posts: 1
Reputation:
Solved Threads: 0
how to delete the last line of the text file using c#.
i applicaiton create a text file ..with 2 empty lines at the end of the File
now i just require a method which open the text file and delete the last 2 lines of the text File ..the code in c# is preferred
yaar please help me out with this on ..
thanks in advance
i applicaiton create a text file ..with 2 empty lines at the end of the File
now i just require a method which open the text file and delete the last 2 lines of the text File ..the code in c# is preferred
yaar please help me out with this on ..
thanks in advance
•
•
Join Date: Sep 2007
Posts: 92
Reputation:
Solved Threads: 15
Dear
Do Something like this.. you can convert your code to C# easily
Note : After that, Edit the existing file and save the finalfile data in it.
Mark as sovled, if it helps you
Regards
Do Something like this.. you can convert your code to C# easily
ASP.NET Syntax (Toggle Plain Text)
Public Shared Function ReadBillFile(ByVal Filename As String) As String Try Dim sr As StreamReader Dim i, linecount As Integer sr = File.OpenText(Filename) Dim contents As ArrayList Dim finalfile As String While Not (sr.EndOfStream) linecount += 1 contents(linecount) += sr.ReadLine End While sr.Close() For i = 1 To contents.Count - 1 finalfile += contents(i) Next Return finalfile Catch ex As IOException MsgBox(ex.Message) End Try End Function
Note : After that, Edit the existing file and save the finalfile data in it.
Mark as sovled, if it helps you
Regards
Last edited by reach_yousuf; Jan 20th, 2009 at 10:26 am.
![]() |
Similar Threads
- read-delete lines from a text file (PHP)
- delete first line from a text file (C++)
- How to delete a row in text file? (Visual Basic 4 / 5 / 6)
- 10 line text file (Java)
Other Threads in the ASP.NET Forum
- Previous Thread: I can not find CopyToDataTable() method (LINQ)
- Next Thread: Filtering the file extensions in Fileupload Control
Views: 3008 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 ajax appliances asp asp.net beginner box browser businesslogiclayer button c# c#gridviewcolumn cac checkbox child class compatible complex confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datalist deadlock deployment development dgv dialog dropdown dropdownmenu dynamic edit embeddingactivexcontrol feedback fileuploader findcontrol flash flv folder form forms grid gridview homeedition hosting iis image index javascript jquery languages list maps menu mobile mssql multistepregistration nameisnotdeclared novell objects order problem profile ratings refer relationaldatabases response.redirect rotatepage search security serializesmo.table sessionvariables silverlight sql ssl tracking treeview typeof update validatedate validation vb.net virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopment wizard xml





