| | |
Delete Blank line(s) from a textbox?
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2007
Posts: 6
Reputation:
Solved Threads: 0
what is the code for searching for and removing a blank line in a multi-line text box? im using VB Express '08 and can not figure it out.
my problem is im loading a sample.text file and using
info,info
info,info
info,info
info,info
info,info
info,info
info,info
info,info
please HELP! i am out of ideas and everything else is working except this. all i need is that blank line to go away. lol
any ideas or suggestions would be most appreciated.
can post more of my code if needed.
my problem is im loading a sample.text file and using
txtFile.AppendText(ControlChars.NewLine & activetext & ",") to add new text from user input and get a blank line that causes problems when converting the text into my array. it looks like this:info,info
info,info
info,info
info,info
info,info
info,info
info,info
info,info
please HELP! i am out of ideas and everything else is working except this. all i need is that blank line to go away. lol
any ideas or suggestions would be most appreciated.
can post more of my code if needed.
•
•
Join Date: Jun 2009
Posts: 270
Reputation:
Solved Threads: 55
to remove the blank lines on reading it ou could do:
if you want to update the textbox you could do:
i've posted both possibility coz it wasnt really clear to me what exactlly u wanted (at what time) ... guess need more coffee
vb Syntax (Toggle Plain Text)
Dim tmp() As String = My.Computer.FileSystem.ReadAllText("C:\test.txt").Split(vbNewLine) For Each newStr As String In tmp If newStr.Length > 2 Then TextBox1.AppendText(newStr & vbNewLine) Next
if you want to update the textbox you could do:
vb Syntax (Toggle Plain Text)
Dim tmp() As String = TextBox1.Text.Split(CChar(vbNewLine)) TextBox1.Clear() For Each line As String In tmp If line.Length > 1 Then TextBox1.AppendText(line & vbNewLine) End If Next
i've posted both possibility coz it wasnt really clear to me what exactlly u wanted (at what time) ... guess need more coffee
You can try this (not tested deeply)
vb.net Syntax (Toggle Plain Text)
Dim SearchIn = Me.TextBox1.Text Dim sb As StringBuilder = New StringBuilder(SearchIn) Me.TextBox1.Text = sb.Replace(vbCrLf + vbCrLf, vbCrLf).ToString
![]() |
Similar Threads
- please help:write to a text file but got a blank first line. (C++)
- How to delete blank lines in a file?? (Python)
- How to delete an empty line in a text file (Python)
- VB6 - How to write a blank Line after writing each record. (Visual Basic 4 / 5 / 6)
- separating line by line from textbox with textmode=multiline (ASP.NET)
Other Threads in the VB.NET Forum
- Previous Thread: Ribbon dll problem
- Next Thread: Refreshing Data Grid Automatically
Views: 1143 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code combobox component convert crystalreport data database datagrid datagridview date dissertation dissertations dropdownlist excel fade file-dialog ftp generatetags google gridview hardcopy highlighting images inline input insert intel internet listview mobile monitor ms net networking objects output passingparameters picturebox picturebox1 port print printing problem problemwithinstallation project remove save searchbox searchvb.net select serial server shutdown soap sorting survey syntax table tcp temperature text textbox timer toolbox trim update updown user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





