![]() |
| ||
| Removing First Line Of Text From multiline textbox Hi all I am kind of new to vb.net, and am wondering if anyone could tell me how I can remove the first line of text from a multiline textbox. Let's say I load a text file with 50 lines into a multiline textbox. How do I delete the first line of text from the textbox and have 49 lines left? Any help will be greatly appreciated. satellites101 |
| ||
| Re: Removing First Line Of Text From multiline textbox 1 Attachment(s) First, you need the following declarations: Private Const EM_GETLINECOUNT As Integer = &HBA Now, I placed this code in a button click event : Counter set = 1 to start from second line. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click See the pic |
| ||
| Re: Removing First Line Of Text From multiline textbox That looks way too complicated. I would just skip the first line as you read it in from the text file. Simple enough. |
| ||
| Re: Removing First Line Of Text From multiline textbox 1) Drag a text box onto your form. Make sure the multiline option is true 2) Drag a button onto your form Imports System.io |
| ||
| Re: Removing First Line Of Text From multiline textbox Great Code iamthwee :) |
| ||
| Re: Removing First Line Of Text From multiline textbox If you want short and simple, try this: Dim b As String() = Split(TextBox1.Text, vbNewLine) |
| ||
| Re: Removing First Line Of Text From multiline textbox Quote:
TextBox1.Text = String.Join(vbNewLine, b, 1, b.Length - 2)To TextBox1.Text = String.Join(vbNewLine, b, 1, b.Length - 1)As it was, it deleted the first and last lines of the textbox. TYVM to all. |
| ||
| Re: Removing First Line Of Text From multiline textbox Sorry about the typo. |
| All times are GMT -4. The time now is 8:43 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC