christheprogrammer
Programmer
Good Mornin'
I have a dataview bound to table 0 of a dataset which in turn was populated by running a simple query on SQL Server. The result set is set of species names of fish. I want to display the dataview in a listbox, but I want to filter out all items containing a left or right paren. I am using a Dataview so that I can also sort the items.
Here is my code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dv As DataView
If Not IsPostBack Then
appDataComponent.fillDataSet(speciesDataSet)
dv = New DataView(speciesDataSet.Tables(0))
dv.Sort = "SPECIES_COMMON_NAME, SPECIES_CODE ASC"
speciesListBox.DataSource = dv
speciesListBox.DataTextField = "SPECIES_COMMON_NAME"
speciesListBox.DataValueField = "SPECIES_CODE"
speciesListBox.DataBind()
End If
End Sub
Which produces a listbox containing something like the follwing:
(GENUS)
(GENUS)
(SUB-FAMILY)
ABYSSAL SKATE
ABYSSAL SNAILFISH
ANCHOVIES (FAMILY)
...
Anyways, I don't want any of the entries containing the parens to appear in the listbox: (GENUS), (SUB-FAMILY), ANCHOVIES (FAMILY)
How do I filter this list?
TIA Chris says: "It's time for a beer."
I have a dataview bound to table 0 of a dataset which in turn was populated by running a simple query on SQL Server. The result set is set of species names of fish. I want to display the dataview in a listbox, but I want to filter out all items containing a left or right paren. I am using a Dataview so that I can also sort the items.
Here is my code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dv As DataView
If Not IsPostBack Then
appDataComponent.fillDataSet(speciesDataSet)
dv = New DataView(speciesDataSet.Tables(0))
dv.Sort = "SPECIES_COMMON_NAME, SPECIES_CODE ASC"
speciesListBox.DataSource = dv
speciesListBox.DataTextField = "SPECIES_COMMON_NAME"
speciesListBox.DataValueField = "SPECIES_CODE"
speciesListBox.DataBind()
End If
End Sub
Which produces a listbox containing something like the follwing:
(GENUS)
(GENUS)
(SUB-FAMILY)
ABYSSAL SKATE
ABYSSAL SNAILFISH
ANCHOVIES (FAMILY)
...
Anyways, I don't want any of the entries containing the parens to appear in the listbox: (GENUS), (SUB-FAMILY), ANCHOVIES (FAMILY)
How do I filter this list?
TIA Chris says: "It's time for a beer."