add text in between lines?

Conejo

Well-known member
Joined
Jul 24, 2013
Messages
65
Location
USA
Programming Experience
1-3
how can i add text to a textbox in this way between each string in a normal textbox?

hi
added text
dhhdhd
added text
 
If you specifically mean adding a line of text to a multiline TextBox then you can make use of its Lines property, which gets or sets the lines of text as a String array. You can get an array from the control, convert the array to a List(Of String) from it so that you can modify it, Insert items into that List as required, convert it back to an array and then assign that array back to the Lines property. Note that the List(Of String) class has a constructor that will accept a String array as its contents and it also has a ToArray method for the conversion back.
 
can you please show me how this is done thanks, i tried but it only adds text in between characters:
Dim length As Integer = code.Text.Length
Dim character As Integer = 0
For character = length To 0 Step -1
code.Text = code.Text.Insert(character, "added text") & vbCrLf
 
It's hardly a surprise that what you did didn't work when it isn't what I instructed. I told you to use the Lines property of the TextBox and to create a List(Of String). You haven't done either of those things so why would it work? The only thing that resembles what I posted is the use of an Insert method, but I told you to Insert into the List. Try again and this time follow my instructions. If you still have issues then I'm willing to help further but you have to at least try to follow instructions first.
 

Latest posts

Back
Top