Office中国论坛/Access中国论坛

标题: ctl 和 ctl.name问题,用哪个,如何用? [打印本页]

作者: sunredday    时间: 2003-5-20 17:48
标题: ctl 和 ctl.name问题,用哪个,如何用?
Option Compare Database

Public Sub cbodropdown([U][B][B]ctl As ComboBox[/B][/B][/U])

ctl.Dropdown

End Sub

Private Sub Form_Load()
Dim ctl As Control
For Each ctl In Me.Controls
   If TypeOf ctl Is ComboBox Then
      ctl.OnDblClick = "=cbodropdown[U][B](" & ctl.Name & ")"[/B][/U]
      End If
   Next ctl
      
End Sub

作者: sunredday    时间: 2003-5-20 17:50
Option Compare Database

Public Sub cbodropdown(ctl As ComboBox)

ctl.Dropdown

End Sub

Private Sub Form_Load()
Dim ctl As Control
For Each ctl In Me.Controls
   If TypeOf ctl Is ComboBox Then
      ctl.OnDblClick = "=cbodropdown(" & ctl.Name & ")"
      End If
   Next ctl
      
End Sub

作者: sunredday    时间: 2003-5-21 06:49
我已经把他放到国外论坛了
http://www.utteraccess.com/forums/showflat.php?Cat=&Board=access_2000&Number=217604&page=0&view=collapsed&sb=5&o=&fpart=1&vc=1&HPSESSID=
作者: Trynew    时间: 2003-5-21 17:32
用ctl.name,然后Sub cbodropdown改为:
Public Sub cbodropdown(ctlname As string)

controls(ctlname).Dropdown

End Sub


作者: sunredday    时间: 2003-5-21 18:41
THANK YOU.  THE WAY YOU TOUGHT ME IS ONE METHOD TO SOLVE THE QUESTIONG BETWEEN CTL AND IT'S NAME.





欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3