|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to remove the last line in a RichTextBoxWhat I want to do is delete the last line in a RichTextBox.
The RichTextBox has a ReadOnly property called lines that seems like it might help but I cant figure out how to use it. Well, the question is what is the easiest way to remove the last line in a RichTextBox? Thanks Hi
The easiest way is to move the cursor to the beginning of the desired line. Next hold down the delete key until all characters have been removed. Hope this helps. The Grand Master Franky wrote: Show quoteHide quote > What I want to do is delete the last line in a RichTextBox. > > The RichTextBox has a ReadOnly property called lines that seems like it > might help but I cant figure out how to use it. > > Well, the question is what is the easiest way to remove the last line in a > RichTextBox? > > Thanks Thanks but my fault, I meant programmatically
Show quoteHide quote "Master Programmer" <master_program***@outgun.com> wrote in message news:1164088928.379830.167610@e3g2000cwe.googlegroups.com... > Hi > > The easiest way is to move the cursor to the beginning of the desired > line. Next hold down the delete key until all characters have been > removed. > > Hope this helps. > The Grand Master > > Franky wrote: >> What I want to do is delete the last line in a RichTextBox. >> >> The RichTextBox has a ReadOnly property called lines that seems like it >> might help but I cant figure out how to use it. >> >> Well, the question is what is the easiest way to remove the last line in >> a >> RichTextBox? >> >> Thanks > I don't know about the [lines] property, but assuming that each
line in the RichTextBox has a carriageReturn/LineFeed combination at the end of it, this should work. Private Sub RemoveLastLine() Dim myData() As String Dim crlfs() As String = {ControlChars.CrLf} Dim lines As String = myRichTextBox.Text 'split it by crlf myData = lines.Split(crlfs, StringSplitOptions.None) 're-join it without the last line Dim outputString As String = _ String.Join(ControlChars.CrLf, myData, 0, myData.Length - 1) myRichTextBox.Text = outputString End Sub Robin S. --------------------------------- Show quoteHide quote " Franky" <frankyNOSPAM@a-znet.com> wrote in message news:eaWF2kNDHHA.4372@TK2MSFTNGP03.phx.gbl... > What I want to do is delete the last line in a RichTextBox. > > The RichTextBox has a ReadOnly property called lines that seems like it > might help but I cant figure out how to use it. > > Well, the question is what is the easiest way to remove the last line in a > RichTextBox? > > Thanks > > > > > Thanks, that looks good.
Show quoteHide quote "RobinS" <RobinS@NoSpam.yah.none> wrote in message news:9pOdnUIAUMdIK__YnZ2dnUVZ_oidnZ2d@comcast.com... >I don't know about the [lines] property, but assuming that each > line in the RichTextBox has a carriageReturn/LineFeed combination > at the end of it, this should work. > > Private Sub RemoveLastLine() > Dim myData() As String > Dim crlfs() As String = {ControlChars.CrLf} > Dim lines As String = myRichTextBox.Text > 'split it by crlf > myData = lines.Split(crlfs, StringSplitOptions.None) > 're-join it without the last line > Dim outputString As String = _ > String.Join(ControlChars.CrLf, myData, 0, myData.Length - 1) > myRichTextBox.Text = outputString > End Sub > > Robin S. > --------------------------------- > " Franky" <frankyNOSPAM@a-znet.com> wrote in message > news:eaWF2kNDHHA.4372@TK2MSFTNGP03.phx.gbl... >> What I want to do is delete the last line in a RichTextBox. >> >> The RichTextBox has a ReadOnly property called lines that seems like it >> might help but I cant figure out how to use it. >> >> Well, the question is what is the easiest way to remove the last line in >> a RichTextBox? >> >> Thanks >> >> >> >> >> > >
Saving the Color value into a string
How do I even start debugging this. User Interface Design - Books? Need for Speed naming conventions forced by VS.NET? Attribute instantiation Can a Decimal variable be set to "Not a Number" find number in a string Trouble displaying info from access db I need 2-3 books on VB.NET, Office automation. Any suggestions? |
|||||||||||||||||||||||