![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
|
VB - File to list box
I'm having trouble making a procedure to read a text file to a list box. I was wondering if anyone could give me a hand?
Here's the crap I've got so far, I've been experimenting with different stuff, atm I get a error saying that count can't equal '1' (I also got '2' at one point =S): Code:
Private Sub ReadFileToList(ByVal ThisList As ListBox, ByVal YourFileName As String)
' gets the application's directory location
Dim StrApplicationPath As String = Directory.GetCurrentDirectory() & "\"
' write some lines of text to the file
Dim inputStream As StreamReader = File.OpenText(StrApplicationPath & YourFileName)
Dim LineFromFile As String
Dim count As Integer
LineFromFile = inputStream.ReadLine()
count = 1
While LineFromFile <> ""
ThisList.Items(count) = (inputStream.ReadLine())
LineFromFile = inputStream.ReadLine()
count = count + 1
End While
'For myitem As Integer = 0 To ThisList.Items.Count - 1
'ThisList.Items(myitem) = (inputStream.ReadLine)
'Next
inputStream.Close()
End Sub
|
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
![]() |
| Thread Tools | |
|
|