请问:如何获取当前行的所有列?我这么写怎么不对?

happyjsj 2003-05-08 12:43:57
Private Sub DataGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Integer
MsgBox DataGrid1.RowContaining(Y)

For i = 0 To (DataGrid1.Columns.Count - 1)
Form2.Label1(i).Caption = DataGrid1.Columns.Item(i)
Form2.Label1(i).ForeColor = &HC00000
Form2.Label1(i).BackStyle = 0
Next i
Form2.Show
Form2.SetFocus
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
MsgBox DataGrid1.RowContaining(Y) 返回的行数,怎么使用DataGrid1.RowContaining(Y)行的所有列的信息

...全文
58 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhp80 2003-05-08
  • 打赏
  • 举报
回复
本例是保存用户开始实施一个拖动方法时所处单元的值。

Dim SaveValue
Sub DataGrid1_MouseDown (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
SaveValue = DataGrid1.Columns(ColValue). _
CellValue(DataGrid1.RowBookmark(RowValue))
DataGrid1.Drag 1
End If
End Sub
hsn1982 2003-05-08
  • 打赏
  • 举报
回复
呵呵
happyjsj 2003-05-08
  • 打赏
  • 举报
回复
不好意思 ,问题我自己解决了!

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧