0

All,

I'm looking to create a simple app that takes text entered by the user and splits it up, based on what line the text is entered on (it's a multiline textbox) using a comma. It inserts this new comma-delimited value into an output textbox for the user.

I know this may be an embarrassingly easy question, but my VB is very rusty: Is there a built-in VB function that can do this without the use of txt files?

Thanks for your help.

Doug Glancy
  • 27,214
  • 6
  • 67
  • 115
Sev09
  • 883
  • 2
  • 12
  • 27

1 Answers1

1

This works for me:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Me.TextBox2.Text = TextBox1.Text.Replace(vbNewLine, ",")
End Sub
Doug Glancy
  • 27,214
  • 6
  • 67
  • 115
  • That works! Another question: what if I also want to add a single quote around each line entry? So the output would look like this: '1','2','3','4','5' I appreciate your help. – Sev09 Dec 27 '13 at 18:35
  • Nevermind, I figured it out: `Me.Output.Text = "('" & Input.Text.Replace(vbNewLine, "','") & "')"` Thanks again! – Sev09 Dec 27 '13 at 18:38
  • 1
    You bet! Happy New Year. – Doug Glancy Dec 27 '13 at 18:46