I'm trying to add add text files to a listbox. I have got the directory box to come up but then when I click add it adds the whole file like
d:/ readings.txt but I want it to display all the readings within the file. This is my code so far.
[CODE=vbnet]Private Sub btnload_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles btnload.Click
openFileDialog1 .InitialDirecto ry = "d:\"
openFileDialog1 .RestoreDirecto ry = True
openFileDialog1 .Multiselect = True
If openFileDialog1 .ShowDialog() = DialogResult.OK Then
For Each iName In openFileDialog1 .FileNames
lbreading.Items .Add(iname)
Next
End If
End Sub[/CODE]
d:/ readings.txt but I want it to display all the readings within the file. This is my code so far.
[CODE=vbnet]Private Sub btnload_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles btnload.Click
openFileDialog1 .InitialDirecto ry = "d:\"
openFileDialog1 .RestoreDirecto ry = True
openFileDialog1 .Multiselect = True
If openFileDialog1 .ShowDialog() = DialogResult.OK Then
For Each iName In openFileDialog1 .FileNames
lbreading.Items .Add(iname)
Next
End If
End Sub[/CODE]
Comment