Hello guys,
i've just encounter some problems during my programming in vb.net or visual basic dot net :)
the problem occurs when i wanted to count rows in a "datagrid" remember, its "DATAGRID" not "datagridVIEW" :)
a lot of website resolve the issues by just stating that use this "Datagridview.rowcount". Believe me, in datagrid, you only have "datagrid.visibleRowCount only! which just count rows that visible to you/datagrid. the hidden rows arn't counted!
so, how to count rows in datagrid?
1. create a integer variable to hold the row count data
dim rowcount as integer
2. next, type:
rowcount = DataGrid1.BindingContext(DataGrid1.DataSource,DataGrid1.DataMember).Count.ToString
(*where DataGrid1 is your datagrid name)
and viola! you've done it! :)
Hope this helps!
0 comments:
Post a Comment