注册 登录
编程论坛 VB6论坛

求助: VB datalist 控件在获得焦点时如何自动选中第一行?

wzchenxg 发布于 2014-06-16 14:04, 458 次点击

如:
   Private Sub Text1_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
         DataList1.SetFocus         
      End If
   End Sub
   Private Sub DataList1_GotFocus()
   ............' 问:如何自动选中第一行的text(颜色变蓝)
   End Sub
2 回复
#2
w3609894262014-06-16 17:58
Private Sub Text1_KeyPress(KeyAscii As Integer)
      If KeyAscii = 13 Then
         DataList1.SetFocus  
sendkeys "{down}"       加一句
      End If
   End Sub
就可以呢
#3
wzchenxg2014-06-16 18:27
回复 2 楼 w360989426
问题解决,非常感谢!我找了很多地方都没有答案,呵呵
1