如何在DATAGRID中选中一行?
如何在DATAGRID控件中做到单击一个单元格的记录就选中这一行记录的效果?也就是单击一个单元格就把这一行的数据全部变色.然后双击将数据导入到另外的一个窗体的相应的TEXT中?各位高手.帮帮忙了. --------------------编程问答-------------------- DataGrid没有试过,可以用MSHFlexGrid
Private Sub MSHFlexGrid1_Click()
With MSHFlexGrid1
For ii=1 To .Cols
.Col=ii
.CellBackColor=vbRed
MsgBox .TextMatrix(.Row,ii)'此为当前选择行的某列的数据
Next ii
End With
End Sub --------------------编程问答-------------------- 呃..貌似DATAGRID可以点一个记录就选中一行的....
用MS的话比较麻烦的说...
高手.知道的赐教下啊. --------------------编程问答-------------------- Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
Dim i As Long
For i = 0 To DataGrid1.SelBookmarks.count - 1
DataGrid1.SelBookmarks.Remove i
Next i
If DataGrid1.Bookmark <> "" Then
DataGrid1.SelBookmarks.add DataGrid1.Bookmark
End If
End Sub --------------------编程问答-------------------- Private Sub DataGrid1_DblClick()
dim jl0-jl9 as string
jl0 = DataGrid1.Columns(0).Text
jl1 = DataGrid1.Columns(1).Text
jl2 = DataGrid1.Columns(2).Text
jl3 = DataGrid1.Columns(3).Text
jl4 = DataGrid1.Columns(4).Text
jl5 = DataGrid1.Columns(5).Text
jl6 = DataGrid1.Columns(6).Text
jl7 = DataGrid1.Columns(7).Text
jl8 = DataGrid1.Columns(8).Text
jl9 = DataGrid1.Columns(9).Text
End Sub --------------------编程问答-------------------- Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If DataGrid1.Row > -1 Then
DataGrid1.SelBookmarks.Add DataGrid1.Bookmark
End If
End Sub
补充:VB , 数据库(包含打印,安装,报表)