ok theres a text.txt that countains somehting like this
a word
2nd word
3rd word
etc
etc
so when I open to listbox loads like this
a word
2nd word
3rd word
....
Printable View
ok theres a text.txt that countains somehting like this
a word
2nd word
3rd word
etc
etc
so when I open to listbox loads like this
a word
2nd word
3rd word
....
Something like this should work for you:
Code:Private Sub Command1_Click()
Dim arItems() As String
Dim sText As String
Dim i As Integer
On Error GoTo ErrHandler
With CommonDialog1
.FileName = ""
.InitDir = "c:\"
.Filter = "Text (*.txt)|*.txt"
.CancelError = True
.ShowOpen
Open .FileName For Input As #1
sText = Input(LOF(1), #1)
Close #1
End With
arItems() = Split(sText, vbNewLine)
For i = 0 To UBound(arItems)
List1.AddItem arItems(i)
Next i
Exit Sub
ErrHandler:
Err.Clear
End Sub
It work'd .. thanks alot :D
You're welcome.
..But still . the List I want to load in has around 70,000 lines.. and doesnt load , Is there a way to bypass that?
Standard Listbox can only handle up to 32,767 (ListCount is Integer type) list items so you may need to substitute Listbox with ListView control.
On a side note - why loading so many items - noone will scroll through that many anyway.
ok , can you help me on listview to load a wordlist there now?
Try forum search - there are tons of samples posted.