Q: Convert TextBox to List(API)
Stephen T. Cerniglia; deputy-_-dawg@msn.com wrote: I'm trying to convert the text from the Text Control and turn each line in the text to a ListBox. If anyone knows how to do this please e-mail me at A: I assume you have multiline on? First you have to check your textbox on a linefeed. When you find one you add the found line to the listbox. Repeat that until the textbox is done: 'make a new project with a form a textbox, listbox and a command button 'set the next code: Private Sub Command1_Click() Text1.Text = "1 more line and checking for a linefeed" & vbCrLf Text1.Text = Text1.Text & "2 more line and checking for a linefeed" & vbCrLf Text1.Text = Text1.Text & "3 more line and checking for a linefeed" & vbCrLf Text1.Text = Text1.Text & "4 more line and checking for a linefeed" Dim strDummy As String Dim intCounter As Integer Dim intStart As Integer strDummy = Text1.Text intStart = 0 list1.Clear For intCounter = 1 To Len(strDummy) If Mid$(strDummy, intCounter, 1) = Chr(10) Then list1.AddItem Mid$(strDummy, intStart + 1, intCounter - intStart - 2) intStart = intCounter End If Next intCounter list1.AddItem Mid$(strDummy, intStart + 1, intCounter - intStart) End Sub Return