Ok, well I now have the following code which takes the first three characters in each line of a text file and puts then in an idlistbox. I now need to code the procedure that parses each line and displays the comma separated values in labels.
Here is my code so far...
VB Code:
Private intRecordcount As Integer = 0 Private Names As New ArrayList() Private Sub OpenFileButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenFileButton.Click 'determine if customers.txt exists If System.IO.File.Exists("customers.txt") = True Then 'make the property labels visible Me.IDNumberLabel.Visible = True Me.NameLabel.Visible = True Me.CreditLimitLabel.Visible = True Me.BalanceDueLabel.Visible = True 'open the text file Dim objStreamReader As System.IO.StreamReader Dim strLine As String objStreamReader = System.IO.File.OpenText("customers.txt") Do Until objStreamReader.Peek = -1 strLine = objStreamReader.ReadLine() Names.Add(strLine) Dim strID As String, intLength As Integer intLength = Val(strLine.Length) strID = strLine.Remove(3, intLength - 3) Me.IDListBox.Items.Add(strID) intRecordcount = intRecordcount + 1 Loop Me.OpenFileButton.Enabled = False 'customers.txt does not exist, stop Else MessageBox.Show("File does not exist!", "File not found", _ MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End If End Sub Private Sub SelectedValueChanged_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IDListBox.Click End Sub




Reply With Quote