¼¼Êõ µã
- ¼¼Êõ
- µã
- V±Ò
- µã
- »ý·Ö
- 21536
|
±¾Ìû×îºóÓÉ todaynew ÓÚ 2012-1-13 22:12 ±à¼
¡¡¡¡ÎÒÒ»Ö±¶ÔÃÀÅ®°æÓѼòµÄִןе½ÎÞÄΣ¬ÄÇÊÇÒ»ÖÖ×êÅ£½Ç¼âºÍײÄÏǽµÄ¾«Éñ£¬ºÇºÇ¡£¶ÔÓÚϸ½Ú´ÓÀ´¶¼ÓÐÁ½ÖÖ˵·¨£¬Ò»ÖÖÊDz»¾ÐÄàϸ½Ú£¬Õâ˵µÄÊÇ˵ÐèÒªÓдó¾ÖºÍºê¹ÛµÄÒâ˼¡£µ«Í¬Ê±Ò²ÓÐÒ»ÖÖ˵·¨£¬½Ð×öħ¹íÒþ²ØÓÚϸ½Ú£¬»òÕßϸ½Ú¾ö¶¨³É°Ü¡£Õâ¿´ÆðÀ´ÓÐЩì¶Ü£¬Æäʵ²»È»¡£ÆäÖеÄÐþÃîÖ»ÊÇÔÚÓÚÊǺÎÖÖϸ½Ú£¬¹Ø¼üµÄϸ½Úµ±È»ÊÇÖØÒªµÄ¡£²»¹ý°æÓѼòµÄÎÊÌâ´ó¶à¶¼ÊÇЩÎ޹شó¾ÖµÄϸ½Ú£¬ÎÒÒÔΪ´ó¿É²»±Ø¹ý¶àµÄ×êÑС£
¡¡¡¡°æÓѼòÕâÁ½ÈÕÌá³öÁËÒ»¸ö¹ØÓÚ±ØÌî¿Ø¼þΪ£î£õ£ì£ìʱ²»µÃʧȥ½¹µãµÄÎÊÌ⣬Õâ¸öÎÊÌâÔÚÎÒ¿´À´²¢²»ÖØÒª¡£°ÑÊý¾Ý±íÖеÄ×Ö¶ÎÉèÖÃΪ±ØÌîÓ¦¸Ã¾Í¿ÉÒÔÁË¡£ÕâÑù×öµÄ²î±ð½ö½öÔÚÓÚ£¬ÕûÌõ¼Ç¼¸üÐÂʱ£¬ÏµÍ³½«×÷³öÌáʾ¡£Í¬Ñù¿ÉÒÔ±£Ö¤±ØÌî×ֶεÄÊý¾Ý²»³öÏÖ£î£õ£ì£ì£¬Òò´Ë˵ÕâÊÇÒ»¸ö·Ç¹ØÖØÒªµÄϸ½Ú¡£
¡¡¡¡²»¹ý¶ÔÓÚ°æÓѼòµÄÎÊÌ⣬ÌÖÂ۵İæÓѺܶ࣬¸ø³öÁËÐí¶àÖֵĴ𰸣¬Ëƺõ°æÓѼò¶¼²»´óÂúÒâ¡£ÓÚÊǺõÎÒ¾õµÃÕâÊÇÒ»¸öͬ־ÃǶ¼¸ÐÐËȤµÄÎÊÌ⣬±ã¾õµÃ¿ÉÒÔ×öÒ»¸öʾÀý¹©´ó¼Ò²Î¿¼¡£²»¹ýÕâ¸öÎÊÌâ̽ÌֵIJã¶ÈÐèÒª½øÒ»²½¼ÓÉÎÒÏëÍƵ¼³ö´¦ÀíµÄÕûÌå˼·À´¡£Õâ¸öÎÊÌâµÄ´¦ÀíÓÐÒÔϵÄÂß¼£º
¡¡¡¡£±¡¢Ò»¸ö¿Ø¼þ²»Ê§È¥½¹µã£¬¿ÉÒÔÀí½âΪ³ýÕâ¸ö¿Ø¼þÍ⣬ÆäËû¿Ø¼þÒ»µ©»ñµÃ½¹µãʼþ´¥·¢£¬¶¼½«µ¼Ö¸ÿؼþ»ñµÃ½¹µã¡£ÕâÊÇÒ»¸öÓÐÒâ˼µÄ·´Ïò˼ά£¬ÕâÖÖ˼άÄÚºÁË·ðѧµÄ¡°ÉáµÃ¡±£¬Ò²½ÒʾÁËÈËÈËΪÎÒÎÒΪÈËÈ˵ĿÆѧ·¢Õ¹¹Û¡£
¡¡¡¡£²¡¢¿Ø¼þµÄÊäÈë¹ý³ÌÊÇÓÐÒ»¶¨ÖÈÐòµÄ£¬ÕâÖÖÖÈÐòÌåÏÖÔڿؼþµÄTabIndexÊôÐÔÉÏ¡£TabIndexÊôÐÔ²»Ò»¶¨Óë¿Ø¼þµÄλÖûòÕß½¨Á¢µÄÇ°ºóÏà¹Ø£¬ÔÒòÔÚÓÚTabIndexÊôÐÔÊÇ¿ÉÒÔµ÷ÕûµÄ¡£Òò´Ëµ±Ç°²»ÄÜʧȥ½¹µãµÄÄǸö¿Ø¼þ£¬¾ÍÊÇÆäֵΪnullÇÒTabIndexÖµ×îСµÄ¿Ø¼þ¡£
¡¡¡¡3¡¢µ±´°Ìå¿Ø¼þ·±¶àʱ£¨¼ÇµÃ°æÓѼòͬ־ÉÆÓÚÕâÑù×ö£©£¬ÖðÒ»±àд¸÷¸ö¿Ø¼þµÄ»ñµÃ½¹µãʼþÊÇÒ»¼þ²»µÀµÂµÄʼþ¡£¼ò»¯ÏàͬµÄ¿Ø¼þʼþ´¦ÀíµÄ½Ý¾¶£¬ÊÇÔÚ´°Ìå¼ÓÔØʱ¸ø¿Ø¼þµÄʼþ¸³ÖµÎªÒ»¸öº¯Êý¡£
¡¡¡¡ÒÀ¾ÝÒÔÉϵÄÂß¼£¬Õâ¸öÎÊÌâµÄÒ»ÖÖÓÐЧ¶ø¼ò½àµÄ´¦Àí·½·¨±ã¡ÖØÍƳöÁË¡£
Private Sub Form_Load()
Dim ctrls As Controls
Dim ctrl As Control
Set ctrls = Me.Controls
For Each ctrl In ctrls
If ctrl.ControlType = acTextBox Or ctrl.ControlType = acComboBox Then
ctrl.OnGotFocus = "=CtrlSetFocus()"
End If
Next
End Sub
Function CtrlSetFocus()
Dim ctrls As Controls
Dim ctrl As Control
Dim i As Integer, m As Integer
m = 100
Set ctrls = Me.Controls
For i = 0 To ctrls.Count - 1
'ControlType¿É¸ù¾ÝÐèÒª½øÒ»²½Ã¶¾Ù£¬Ò²¿ÉÔÙÌ×Ò»²ãIfÓÃÓÚÅųý·Ç±ØÌî¿Ø¼þ¡£
If ctrls(i).ControlType = acTextBox Or ctrls(i).ControlType = acComboBox Then
If IsNull(ctrls(i).Value) = True Then
If ctrls(i).TabIndex < m Then
Set ctrl = ctrls(i)
m = ctrls(i).TabIndex
End If
End If
End If
Next
If m <> 100 Then
ctrl.SetFocus
End If
End Function
|
±¾Ìû×ÓÖаüº¬¸ü¶à×ÊÔ´
ÄúÐèÒª µÇ¼ ²Å¿ÉÒÔÏÂÔØ»ò²é¿´£¬Ã»ÓÐÕʺţ¿×¢²á
x
|