往DataGrid里添加数据的时侯,不能很自由的控制焦点,请问有没有办法解决?

snowerhuayun 2004-01-15 04:27:22
在DataGrid里按回车键不能自动移动到下一个,有办法解决吗?
...全文
87 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
northwolves 2004-01-21
  • 打赏
  • 举报
回复
Private Sub DataGrid1_KeyPress(KeyAscii As Integer)
On Error Resume Next
Dim row As Long, col As Long
row = DataGrid1.row
col = DataGrid1.col
If KeyAscii = 13 Then
If DataGrid1.col = DataGrid1.Columns.Count - 1 Then
DataGrid1.row = row + 1
DataGrid1.col = 0
Else
DataGrid1.col = col + 1
End If
End If
End Sub
TIANHEI 2004-01-21
  • 打赏
  • 举报
回复
对用KeyPress监控
sword281 2004-01-21
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2393/2393178.xml?temp=5.239505E-02
华芸智森 2004-01-21
  • 打赏
  • 举报
回复
更正一下,忘记了一句话:On Error Resume Next


Private Sub DataGrid1_KeyPress(KeyAscii As Integer)
Dim I As Long

On Error Resume Next

If KeyAscii = 13 Then
I = DataGrid1.Row()
DataGrid1.Row = I + 1
End If
End Sub
华芸智森 2004-01-21
  • 打赏
  • 举报
回复

Private Sub DataGrid1_KeyPress(KeyAscii As Integer)
Dim I As Long
If KeyAscii = 13 Then
I = DataGrid1.Row()
DataGrid1.Row = I + 1
End If
End Sub
j4sxw 2004-01-15
  • 打赏
  • 举报
回复
daisy8675 2004-01-15
  • 打赏
  • 举报
回复
ms社區有篇是按tab可以移動﹐應該可以﹐但是沒有嘗試。
你是要加數據時候移動還是在瀏覽數據時候﹐移動到下一條?

7,759

社区成员

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

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