'VB6 datagrid单击单元格,返回单元格的值.Private Sub DataGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim RowValue, ColValue RowValue = DataGrid1.RowContaining(Y) ColValue = DataGrid1.ColContaining(X)
If RowValue >= 0 And RowValue <= DataGrid1.VisibleRows And _ ColValue >= 0 And ColValue <= DataGrid1.VisibleCols Then DataGrid1.Row = RowValue MsgBox DataGrid1.Columns(ColValue).Value ' End If End Sub----------------------------------------------------------------Private Sub DataGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim RowValue, ColValue RowValue = DataGrid1.RowContaining(Y) ColValue = DataGrid1.ColContaining(X)
If RowValue >= 0 And RowValue <= DataGrid1.VisibleRows And _ ColValue >= 0 And ColValue <= DataGrid1.Columns.Count Then DataGrid1.Row = RowValue Text1.Text = DataGrid1.Columns(ColValue) ' End If End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer) MsgBox DataGrid1.Columns(0) & " " & DataGrid1.Columns(1)
End Sub
Private Sub DataGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim rowValue, colmValue rowValue = DataGrid1.RowContaining(Y) colmValue = DataGrid1.ColContaining(X) DataGrid1.Row = rowValue Label1.Caption = DataGrid1.Columns(colmValue).Text
'VB6 datagrid单击单元格,返回单元格的值.Private Sub DataGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim RowValue, ColValue
RowValue = DataGrid1.RowContaining(Y)
ColValue = DataGrid1.ColContaining(X)
If RowValue >= 0 And RowValue <= DataGrid1.VisibleRows And _
ColValue >= 0 And ColValue <= DataGrid1.VisibleCols Then
DataGrid1.Row = RowValue
MsgBox DataGrid1.Columns(ColValue).Value '
End If
End Sub----------------------------------------------------------------Private Sub DataGrid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim RowValue, ColValue
RowValue = DataGrid1.RowContaining(Y)
ColValue = DataGrid1.ColContaining(X)
If RowValue >= 0 And RowValue <= DataGrid1.VisibleRows And _
ColValue >= 0 And ColValue <= DataGrid1.Columns.Count Then
DataGrid1.Row = RowValue
Text1.Text = DataGrid1.Columns(ColValue) '
End If
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
MsgBox DataGrid1.Columns(0) & " " & DataGrid1.Columns(1)
End Sub
Dim rowValue, colmValue
rowValue = DataGrid1.RowContaining(Y)
colmValue = DataGrid1.ColContaining(X)
DataGrid1.Row = rowValue
Label1.Caption = DataGrid1.Columns(colmValue).Text