我在设计时用了DataGrid的VisibleRowCount属性,可是用它获得和只是当前显示的行数,
如何获得DataGrid中的总行数呢?
[此贴子已经被作者于2006-3-6 11:30:45编辑过]
Dim strSQL As String
Dim ds As New DataSet
Dim da As SqlDataAdapter
'"SELECT * FROM vwFirstGroup WHERE 车次='" & mSelectTrainCode & "' "
da = New SqlDataAdapter(strSQL, cn)
da.Fill(ds, "Table3")
Dim dv As DataView = ds.Tables(0).DefaultView
Dim tableStyle As DataGridTableStyle
tableStyle = New DataGridTableStyle
tableStyle.MappingName = "Table3"
DataGrid3.TableStyles.Clear()
DataGrid3.TableStyles.Add(tableStyle)
DataGrid3.DataSource = dv
'去掉蓝色标题栏
DataGrid3.CaptionVisible = False
'去掉列显示
DataGrid3.ColumnHeadersVisible = False
'现在实际的记录数
mNowCol = ds.Tables(0).Columns.Count()