Visual Basic Explorer
Visual Basic Explorer
 Navigation
 Home


 Coding
 Source Code

 FAQ Center

 VB Tips

 Downloads

 ToolBox

 Tutorials

 VB Games

 VB News

 VB Award

 VB Forums



 Affiliates
 Planet Source Code

 Rent a Coder

 DirectX4VB


 Misc
 Search

 Feedback

 Advertise

 About


Need to hire
a VB coder?

Please support our sponsor:

 Home 
 Site Map 
 Forums 
 News 
 Feedback 

 

'Multiline Textbox Contents to Listbox?

 
Q. My program has a multi-line textbox, a listbox, and a button. I want the
contents of the textbox copied line by line to the listbox when the user clicks
the button.

 
A. Use a Do-Loop to run through Text1.Text, locating the carriage return/line
feeds (CrLf), and copying the text between them to the Listbox:

 
Dim sTmp As String, iPos1 As Integer, iPos2 As Integer

sTmp = Text1.Text
iPos1 = 1
iPos2 = InStr(sTmp, vbCrLf)
Do While iPos2
List1.AddItem Mid$(sTmp, iPos1, iPos2 - iPos1)
iPos1 = iPos2 + 1
iPos2 = InStr(iPos1, sTmp, vbCrLf)
Loop

Thanks to: Chris Schore, Bob Walsh


Downloads

In IE right-click and select 'Save Target As...' or in Netscape right-click and select 'Save Link As...'

 

View Plain Text View Plain Text
Download Demo Project Not Available
View Code Online Not Available





Home | About | What's New | Source Code | FAQ | Tips & Tricks | Downloads | ToolBox | Tutorials | Game Programming | VB Award | Search | VB Forums | Feedback | VBNews | Copyright & Disclaimer | Advertise | Privacy Policy |

Quick searches: Site Search | Advanced Site Search 

Copyright 2002 by Exhedra Solutions, Inc.
By using this site you agree to its terms and conditions
VB Explorer and VBExplorer.com are trademarks of Exhedra Solutions, Inc.