Here is the code that I already have:
At the moment this code populates the data table with all of the data from the text file and displays the stopname in the combo boxes.
I want to be able to populate the data table with strings of data that start with a particular number. Can anyone explain or show me how to do this?
If this is too vague or you need to know more information - please do ask. ^___^
VB.NET:
Private Sub frmCalculateFareIssueTicket_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dt As New DataTable
Dim RouteNo As Integer = frmDriversSection.RouteNo
With dt.Columns
.Add("RouteNo", GetType(Integer))
.Add("StopNo", GetType(Integer))
.Add("StopName", GetType(String))
End With
For Each line In IO.File.ReadAllLines("stops.txt")
dt.Rows.Add(line.Split(","c))
Next
With cmbStartStop
.DataSource = dt
.DisplayMember = "StopName"
.ValueMember = "StopNo"
.SelectedIndex = 0
End With
With cmbDestStop
.DataSource = dt
.DisplayMember = "StopName"
.ValueMember = "StopNo"
.SelectedIndex = 0
End With
End Sub
At the moment this code populates the data table with all of the data from the text file and displays the stopname in the combo boxes.
I want to be able to populate the data table with strings of data that start with a particular number. Can anyone explain or show me how to do this?
If this is too vague or you need to know more information - please do ask. ^___^