Feeding a Listbox with a Stream; I am new to streams from VB6. What am I missing?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
Hello,
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small I am new to .NET from VB6. So I do not have any background with streams, however the concept seems straight forward.
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small I am trying to populate a listbox using
the ADD method with the data originating in a text file. Using a stream reader I am aquiring the data (I can prove that the data is there at every itteration using the debugging tools). However, it doesnt make it into the listbox. I have other data appear
withn the listbox in a couple of different ways just to prove that there is nothing wrong with the way the listbox is setup or coded. The listbox is a single instance item on a form, all setup is done through the properties window.
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small I
am using VS2010 Professional (Visual Basic) with Framework 4.0 as the development enviroment.
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small Thank
you for assistance with this ahead of time.
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; Private <span style="color:Blue; Sub tbxFullPath_TextChanged(<span style="color:Blue; ByVal sender <span style="color:Blue; As <span style="color:Blue; Object, <span style="color:Blue; ByVal e <span style="color:Blue; As System.EventArgs) <span style="color:Blue; Handles tbxFullPath.TextChanged

<span style="color:Blue; Dim sIn <span style="color:Blue; As IO.StreamReader
<span style="color:Blue; Dim CurrentLine <span style="color:Blue; As <span style="color:Blue; String
<span style="color:Blue; Dim bDone <span style="color:Blue; As <span style="color:Blue; Boolean = <span style="color:Blue; False

sIn = <span style="color:Blue; New IO.StreamReader(FullPath)
<span style="color:Blue; Try
<span style="color:Blue; While <span style="color:Blue; Not bDone
CurrentLine = sIn.ReadLine
<span style="color:Blue; If CurrentLine <span style="color:Blue; Is <span style="color:Blue; Nothing <span style="color:Blue; Then
bDone = <span style="color:Blue; True
<span style="color:Blue; Else
lbxRS274_Display.Items.Add(CurrentLine)
<span style="color:Blue; End <span style="color:Blue; If
<span style="color:Blue; End <span style="color:Blue; While
<span style="color:Blue; Catch ex <span style="color:Blue; As Exception
MsgBox(<span style="color:#A31515; "File failed to Open")
<span style="color:Blue; Finally
sIn.Close()
<span style="color:Blue; End <span style="color:Blue; Try

<span style="color:Blue; End <span style="color:Blue; Sub
[/code]
<br/>
TroubleTech
<span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small <span style="font-family:Consolas; font-size:x-small
<span style="font-family:Consolas; color:#0000ff; font-size:x-small

View the full article
 
Back
Top