Skip to content

How add a dash to the beginning of all lines of the text box except the first line in vb .net? #7464

Answered by miloush
VahidEra asked this question in Q&A
Discussion options

You must be logged in to vote

Assuming you don't care about performance very much, you would need:

  1. split the string using String.Split, use e.g. Environment.NewLine as a seperator, this will give you an array of strings
  2. go through the array and add dashes at the beginning of the strings you want (i.e. replace the element in the array with a new string)
  3. join the array back into single string using String.Join and Environment.NewLine as a separator
  4. set the TextBox.Text to the joined string

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@VahidEra
Comment options

Answer selected by VahidEra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants