Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - Getting contents of a Text Box into a List Box? [VB Help] | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
RoboticParanoia Cheep-cheep Level: 23 Posts: 12/184 EXP: 60582 For next: 7141 Since: 03-23-04 From: Texas Since last post: 150 days Last activity: 150 days |
| ||
In my program, I need to export the contents of a List Box into a Text Box so it could go into a text file. I figured that part out (however, if somone knows a more direct way of putting a List Box into a text file, then feel free to tell me). However, I am not exactly sure on how to do the opposite...getting the contents of the text box into the list box. I need to do it in a way so that each line would be each item of the line box. Is there some way or function of calling a text box by it's lines, and exporting them into a string or something similar? I apologize if this post is confusing. |
|||
Chickenlump Level: 41 Posts: 125/722 EXP: 474192 For next: 5953 Since: 03-15-04 From: Columbia City Indiana Since last post: 3 hours Last activity: 4 min. |
| ||
This is how I get a listbox into a textbox. (in case it's different than yours) Private Sub Command3_Click() itemSelectedindex = List1.ListIndex Text25.Text = Text25.Text & List1.Text & vbCrLf Dim IntNext As Integer, IntMax As Integer Text25.Text = "" Text25.Refresh IntMax = List1.ListCount For IntNext = 0 To IntMax - 1 itemSelectedindex = Me.List1.List(IntNext) Text25.Text = Text25.Text & itemSelectedindex & vbCrLf Next End Sub Hope this helps you out some. (edited by Chickenlump on 04-09-04 11:23 AM) |
|||
RoboticParanoia Cheep-cheep Level: 23 Posts: 13/184 EXP: 60582 For next: 7141 Since: 03-23-04 From: Texas Since last post: 150 days Last activity: 150 days |
| ||
II think that would actually work better then my way....(which was to use the List contents as strings using the List Index or whatever, and string them all together using "vbCrLf". Of course, I haven't tested it out yet....but yeah. Your method probably would work bette.r |
|||
Tuvai Permanently banned for account hacking. Level: 24 Posts: 177/211 EXP: 74894 For next: 3231 Since: 03-15-04 Since last post: 566 days Last activity: 339 days |
| ||
What values are in the text box? If they're all one word or every entry that needs to be sepparately in the listbox is on it's own line in the textbox, you could use the split() function too. | |||
RoboticParanoia Cheep-cheep Level: 23 Posts: 14/184 EXP: 60582 For next: 7141 Since: 03-23-04 From: Texas Since last post: 150 days Last activity: 150 days |
| ||
Originally posted by Tuvai The values are file paths in the text box. The values then go to the list box. How does the split() function work? I think that was the one I was thinking of at first, but I'm not sure. |
|||
Tuvai Permanently banned for account hacking. Level: 24 Posts: 180/211 EXP: 74894 For next: 3231 Since: 03-15-04 Since last post: 566 days Last activity: 339 days |
| ||
Here's a short example of how split works (just open up a new project and put this in the window code): ---------- Option Explicit Private Sub Form_Load() Dim TestString As String, SplitString() As String TestString = "I_Like_Pie" SplitString = Split(TestString, "_") MsgBox SplitString(0) MsgBox SplitString(1) MsgBox SplitString(2) End Sub ---------- Function name pretty much explains it, it splits stuff by delimiters (which can be more than one character). If you've worked with PHP before, Visual Basic's split() is the same as PHP's explode(). |
|||
RoboticParanoia Cheep-cheep Level: 23 Posts: 15/184 EXP: 60582 For next: 7141 Since: 03-23-04 From: Texas Since last post: 150 days Last activity: 150 days |
| ||
Ah! Thank you. I believe that will work. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - Getting contents of a Text Box into a List Box? [VB Help] | | | |