Sinisterly
adding to textbox help - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.li/Forum-Visual-Basic-NET-Framework)
+--- Thread: adding to textbox help (/Thread-adding-to-textbox-help)



adding to textbox help - FrostByte_mybb_import5923 - 05-21-2011

hey everyone, is it posible for me to select a certain line in a rch textbox for me to add to so

a code like

RichTextBox1.Text = RichTextBox1.Text.line3 & ("current text")

obviously that wont work, but ho would i be able to do that.



RE: adding to textbox help - Coder-san - 05-22-2011

Load and split the RichTextBox in a String Array in newlines.

Code:
Dim ArrLine As String() = Split(RichTextBox1.Text, vbNewLine) MessageBox.Show(ArrLine(2)) 'Get Third line



RE: adding to textbox help - FrostByte_mybb_import5923 - 05-22-2011

thanks for your help but that doesnt work, it says (Index was outside the bounds of the array.) error


RE: adding to textbox help - Coder-san - 05-22-2011

well of course you need more than 3 lines of text in the RichTextBox for that to work.


RE: adding to textbox help - FrostByte_mybb_import5923 - 05-22-2011

but thats the thing i have more than 3 i have about 12 lines confused


RE: adding to textbox help - Coder-san - 05-22-2011

This should work, didn't know RichText had different linebreaks.

Code:
Dim ArrLine As String() = RichTextBox1.Lines Me.Text = ArrLine(2) 'Get Third line