how to set focus at the control whose tabindex is the smallest when a form is loaded, how to set focus at a control which has the smallest tabindex? if you will pls show coding to me ,thanks a lot 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 焦点不是可以自动落在tabindex最小的控件上吗? 在load事件中,可以加上 ***.setfocus就行。 Private Sub Form_Activate() ***.setfocusEnd Sub but if I do not know which control is disable,which is enable ,how can I set focus?using activecontrol is right?how to use it? Private Sub Form_Activate() Dim ctl As Control For Each ctl In Me.Controls If ctl.Enabled Then ctl.SetFocus End If NextEnd Sub Private Sub Form_Activate() Dim ctl As Control Dim ctlSmallTab As Control Set ctlSmallTab = Me.Controls(0) For Each ctl In Me.Controls If ctl.TabIndex < ctlSmallTab.TabIndex And ctl.Enabled Then Set ctlSmallTab = ctl End If Next ctlSmallTab.SetFocus End Sub 求结构 vb+sql物品管理如何设计数据记录与图片管理 activex 菜问题:怎样把excel转为access?? 数据库插入有问题?请高手解决一下 有人知道SQL Server的OLE DB驱动怎么打包吗????? vb+sql server2000 怎样显示从数据库中查询出来的图片 有VB中怎么样以“post”方式将表单数据提交到网页,急------ 如何定位弹出式菜单的弹出位置? 谁有直接画线的报表打印程序啊? 你做过这样的程序么? 怎样将DATAGRID中显示的记录集导入到EXCEL表格中? 数据库+报表
***.setfocus
End Sub
using activecontrol is right?how to use it?
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Enabled Then
ctl.SetFocus
End If
Next
End Sub
Dim ctl As Control
Dim ctlSmallTab As Control
Set ctlSmallTab = Me.Controls(0)
For Each ctl In Me.Controls
If ctl.TabIndex < ctlSmallTab.TabIndex And ctl.Enabled Then
Set ctlSmallTab = ctl
End If
Next
ctlSmallTab.SetFocus
End Sub