vb.net datagridview with dataset as datasource -
vb.net datagridview with dataset as datasource -
my question is, there way filter records in dataset , utilize records fill in datagridview? example, datatable (with 3 columns: id
, studentname
, gender
) filled list of students. have 2 datagrids in form namely datagridview1
, datagridview2
. datagridview1
the list of pupil gender
equal m
, datagridview2
the list of pupil gender
equal f
.
in current solution, using loop.
for each istud datarow in idataset.tables(0).rows if istud.item("gender").tostring = "m" 'add record datagridview1 else 'add record datagridview2 end if next
is there way without using loop?
yes, there is. need filter dataset using select
.
for example,
datagridview1.datasource = xset.tables("studentlist").select("gender = 'm'") datagridview2.datasource = xset.tables("studentlist").select("gender = 'f'")
brief explanation:
xset name of dataset studentlist name of datatable gender name of column want filter
update
vb.net datagridview dataset
Comments
Post a Comment