|
-
Nov 23rd, 2010, 09:24 PM
#1
Thread Starter
New Member
Load a Text file
how do i load a textfile into a listbox in a form?
-
Nov 23rd, 2010, 09:39 PM
#2
Junior Member
Re: Load a Text file
what you mean text file. like the whole thing or just the name of the text file? the whole text file would be better off in a text box unless you want to list each like as an item in the list box.
i would have to research as i am new but i would google file system movement and opening and closing files. i am sure vb has something similiar to filereader and filewriter in java or fopen and such. once yu open it the text file can be manipulated my reading it and doing what you want with it until EOF.
look for chr(13) and chr(10) to denote end line and such. i would look this up becausE IT IS USEFUL AND TELL YOU THE CODE BUT I AM NEEDING A SMOKE RIGHT NOW. IF I GET NBACK AND YOU WANT SOME MORE LET ME KNOW WHAT WITH THE TEXT FILE YOU WANT TO DO WITH A LISTBOX EXACTLY.
sorry if this doesn;t directly answer your question.
-
Nov 23rd, 2010, 10:36 PM
#3
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Nov 24th, 2010, 07:30 AM
#4
Re: Load a Text file
Try
vb Code:
Private Sub Command1_Click()
Dim arrLines() As String
Dim lngCount As Long
Dim i As Long
Open "c:\textfile.txt" For Input As #1
arrLines = Split(Input(LOF(1), #1), vbCrLf)
Close #1
lngCount = UBound(arrLines)
For i = 0 To lngCount
List1.AddItem arrLines(i)
Next
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|