Board logo

¼ÐÃD: [µo°Ý] ¦p¦ó§PÂ_§Ú­è©Ò¥´¤ÄªºCheckBox [¥´¦L¥»­¶]

§@ªÌ: av8d    ®É¶¡: 2012-8-1 00:08     ¼ÐÃD: ¦p¦ó§PÂ_§Ú­è©Ò¥´¤ÄªºCheckBox

For  i = 1 To  4
If Me.Controls("CheckBox" & i).Value = True

¥H¤W¬O§PÂ_1~4¬O§_¦³³Q¥´¤Ä~¦ý¬O¥L¨C¦¸¤@©w·|±q1¶}©l§PÂ_~
¬O§_¦³¤èªkÅý¥L§PÂ_­þ¤@­Ó¬O§Ú­è¥´¤ÄªºCheckBox
§@ªÌ: oobird    ®É¶¡: 2012-8-1 08:06

ªþ¥ó¥Ü¨Ò
[attach]11973[/attach]
§@ªÌ: av8d    ®É¶¡: 2012-8-1 20:37

¦^´_ 2# oobird


        ¤j¤j~§Úªº·N«ä¬O~§Ú¦³10­ÓCheckBox
§Ú§Æ±æ§ÚÂI¤@¤UCommednBurron«á±N§Ú³Ì«á¤@­ÓÂI¤UªºCheckBox.Captionªº­È¥áµ¹TextBox1
§@ªÌ: GBKEE    ®É¶¡: 2012-8-1 20:55

¦^´_ 3# av8d
2# oobird  ªþÀÉ ª«¥óÃþ§O¼Ò²Õ
  1. Option Explicit
  2. Public WithEvents CheckboxGroup As MSForms.CheckBox
  3. Private Sub CheckboxGroup_Click()
  4.    '-------¤èªk1  ª½±µµ¹¥¦
  5.    UserForm1.TextBox1 = CheckboxGroup.Caption
  6.    
  7.    '-------¤èªk2 ÂI¤@¤UCommednBurron
  8.    '»¡©ú UserForm1¼Ò²Õ »Ý Public xlText as  String
  9.      UserForm1.xlText = CheckboxGroup.Caption
  10.    '»¡©ú UserForm1¤¤ CommednBurron µ{¦¡-> UserForm1.TextBox1 = UserForm1.xlText
  11.    
  12.    'MsgBox "You Click " & CheckboxGroup.Caption & vbNewLine & _
  13.     "Value is " & CheckboxGroup.Value
  14. End Sub
½Æ»s¥N½X

§@ªÌ: av8d    ®É¶¡: 2012-8-1 21:34

¦^´_ 4# GBKEE


    G¤j§Úªº·N«ä¬O~§Ú¦³10­ÓCheckBox
§Ú§Æ±æ§ÚÂI¤@¤UCommednBurron«á
±N§Ú³Ì«á¤@­ÓÂI¤UªºCheckBox.Caption & CommednBurron.Captionªº­È¥áµ¹TextBox1

¦A¦¸·PÁÂG¤j¦b»ä­·¤Ñ¸Ì©âªÅÀ°§U~ÁÂÁ±z!

­è´ú¸Õ¤F¤@¤U~¤èªk2·|¥X²{¿ù»~~§Ú±NÀɮפW¶Ç¦p¤U

[attach]11987[/attach]
§@ªÌ: Hsieh    ®É¶¡: 2012-8-2 00:19

¦^´_ 5# av8d

µy·L¤F¸Ñ¤@¤Uª«¥óÃþ§Oªº¬yµ{
[attach]11992[/attach]
§@ªÌ: GBKEE    ®É¶¡: 2012-8-2 06:43

¦^´_ 5# av8d
§Ú¦b4# ¦³¼g¬O 2# oobird  ªþÀÉ ª«¥óÃþ§O¼Ò²Õ
ª«¥óÃþ§O¼Ò²Õ cControlArray µ{§Ç ¦p¤U
  1. Option Explicit
  2. Public WithEvents CheckboxGroup As MSForms.CheckBox
  3. Private Sub CheckboxGroup_Click()
  4.     UserForm1.xlText = CheckboxGroup.Caption
  5. End Sub
½Æ»s¥N½X
UserForm1 ªºµ{¦¡½X
  1. Public xlText As String
  2. Private Sub CommandButton1_Click()
  3.    '»¡©ú UserForm1¤¤ CommednBurron µ{¦¡
  4.    UserForm1.TextBox1 = UserForm1.xlText
  5. End Sub
  6. Private Sub UserForm_Initialize()
  7. Dim cCBs As Integer
  8. Dim ctl As Control
  9.    cCBs = 0
  10.    For Each ctl In Me.Controls
  11.        If TypeName(ctl) = "CheckBox" Then
  12.            cCBs = cCBs + 1
  13.            ReDim Preserve aryCBs(1 To cCBs)
  14.            Set aryCBs(cCBs).CheckboxGroup = ctl
  15.        End If
  16.    Next ctl
  17. End Sub
½Æ»s¥N½X
§Ú¤§©Ò¥H¤£ª½±µ¤W¶ÇÀÉ®× ¬O§Æ±æ¦U¦ì¦h½m²ß¤~·|¶i¨Bªº
§@ªÌ: av8d    ®É¶¡: 2012-8-2 13:42

¦^´_ 7# GBKEE


    ·PÁ¦U¦ì¦Ñ®v¦b»ä­·¤Ñ¨S©ñ°²ÁÙ¨ÓÀ°¦£~¦¹µª®×Åý§Ú¾Ç²ß¤Fª«¥óÃþ§O¼Ò²Õ~
§@ªÌ: av8d    ®É¶¡: 2012-8-7 16:04

¦^´_ 7# GBKEE


    ½Ð°Ý¦pªG­n©Ò¦³UserForm~¬O§_¥u¯à¦bUserForm1¤U·s¼WUserForm2 ? ÁÙ¬O¯à¤@¦¸«Å§i¥þ³¡UserForm ?
§@ªÌ: GBKEE    ®É¶¡: 2012-8-7 16:36

¦^´_ 9# av8d

7# ¬O UserForm1 ªºµ{¦¡½X
¦³³\¦h UserForm ¨º¦b¨C¤@UserForm µ{¦¡½X¤¤ ¨Ì¼Ëµe¸¬Äª¼g¤U¥¦¦Û¤vªºµ{¦¡½X
§@ªÌ: av8d    ®É¶¡: 2012-8-8 11:19     ¼ÐÃD: ¦p¦ó½Æ»sUserForm

§Ú·Q±NUserForm1½Æ»s¨ìUserForm2
§@ªÌ: mark15jill    ®É¶¡: 2012-8-8 11:28

¦]¤£²M·¡³æ¯Â¥þ³¡½Æ»s(®æ¦¡ ª«¥ó  µ{¦¡½X) ÁÙ¬O ³æ¤@³¡¤À  ¬G´£´XÂI«Øij

¤èªk1.  userform1 ¶×¥X«á ¦A¶×¤J.. (name °O±o§ï ÁÙ¦³µ{¦¡½X¤º userform1°O±o§ï2
¤èªk2.  userform1 ½Æ»s«á  userform2¶K¤W  (ª«¥ó¤@¦¸ µ{¦¡½X¤@¦¸)
§@ªÌ: av8d    ®É¶¡: 2012-8-8 15:14

¦^´_ 10# GBKEE

¦]¬°¥u§ï¥H¤U~µ{¦¡·|¿ù¶Ã!
    Private Sub CheckboxGroup_Click()
    UserForm2.xlText = CheckboxGroup.Caption
    UserForm3.xlText = CheckboxGroup.Caption
    UserForm4.xlText = CheckboxGroup.Caption
    End Sub

¬O§_­n¹ï
xlText ©M CheckboxGroup Åܼƪº«Å§i?
§@ªÌ: GBKEE    ®É¶¡: 2012-8-8 15:53

¦^´_ 13# av8d
­n¤F¸Ñª«¥ó

    [attach]12050[/attach]
§@ªÌ: av8d    ®É¶¡: 2012-8-13 14:07

¦^´_ 14# GBKEE


    ¤j¤j~½Ð°ÝUserForm2.xlTextªº­È¬O?
§@ªÌ: av8d    ®É¶¡: 2012-8-13 14:29

¦^´_ 7# GBKEE
Private Sub CommandButton1_Click()
   '»¡©ú UserForm1¤¤ CommednBurron µ{¦¡
   UserForm1.TextBox1 = UserForm1.xlText
End Sub

UserForm1.xlTextªº­È~¥Ø«e§Ú¹ïÀ³¤£¥X¨Ó~½Ð¤j¤j¸Ñ»¡~ÁÂÁÂ!
§@ªÌ: av8d    ®É¶¡: 2012-8-13 14:49

¦^´_ 7# GBKEE


    §Ú¦b»¡©ú¸Ô²Ó¤@ÂI~¤j¤j7¼Óªº¥¿¦¡§Ú­nªº»Ý¨D~
¦ý¬O·íUserForm¼W¥[~©Ò¿ï¨úªº³Ì«á¤@­ÓCheckBox«hµLªk«ü¦V¨ì³Ì«á¤@¦¸ÂI¿ïªº~
    Private Sub CheckboxGroup_Click()
    UserForm2.xlText = CheckboxGroup.Caption
    End Sub
¥H¤W¨S°ÝÃD

    Private Sub CheckboxGroup_Click()
    UserForm2.xlText = CheckboxGroup.Caption
    UserForm3.xlText = CheckboxGroup.Caption
    UserForm4.xlText = CheckboxGroup.Caption
    End Sub
¥H¤W¬OUserForm¼W¥[«á~¥X²{¤F°ÝÃD!
§@ªÌ: GBKEE    ®É¶¡: 2012-8-14 06:42

¦^´_ 17# av8d
7#  UserForm1ªºµ{¦¡½X ¬O¨Ì 2# ªºªþÀɭקï
2# ªºªþÀɤ¤aryCBs ÅÜ¼Æ ¬O Module1 ªº¤½¥ÎÅܼÆ
¦p¤µ§A¦³4­ÓUserForm ¬Ò¶·¨p¦³ªº aryCBsÅܼÆ
  1. '4­ÓUserForm ªº µ{¦¡½X
  2. Public xlText As String
  3. Dim aryCBs()  As New cControlArray
  4. Private Sub UserForm_Initialize()
  5. Dim cCBs As Integer
  6. Dim ctl As Control
  7.    cCBs = 0
  8.    For Each ctl In Me.Controls
  9.        If TypeName(ctl) = "CheckBox" Then
  10.            cCBs = cCBs + 1
  11.            ReDim Preserve aryCBs(0 To cCBs)
  12.            Set aryCBs(cCBs).CheckboxGroup = ctl
  13.        End If
  14.    Next ctl
  15. End Sub
½Æ»s¥N½X

§@ªÌ: c_c_lai    ®É¶¡: 2012-8-14 12:18

¦^´_ 18# GBKEE
Test.rar ùرz¬O¨Ï¥Î ReDim Preserve aryCBs(1 To cCBs)¡A
¦Ó¦¹³B±z¥Î ReDim Preserve aryCBs(0 To cCBs)
¤@­Ó¬O±q 0 ¶}©l°_ºâ¡A ¥t¤@²Õ¬O±q 1 ¶}©l°_ºâ¡A
¦ý Test.rar  ¤§ aryCBs(1 To  1)  (²Ä¤@¦¸) ´N¦n¹³¨S·N¸q¤F¡H
½Ð¦h«ü±Ð¡I
§@ªÌ: GBKEE    ®É¶¡: 2012-8-14 14:38

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-8-14 14:42 ½s¿è

¦^´_ 19# c_c_lai
¤@­Ó¬O±q 0 ¶}©l°_ºâ¡A ¥t¤@²Õ¬O±q 1 ¶}©l°_ºâ¡A¦ý Test.rar  ¤§ aryCBs(1 To  1)  (²Ä¤@¦¸) ´N¦n¹³¨S·N¸q¤F¡H
³o°Ýªº¦n!  ·q¨Ø¤F ¬Ýªº«Ü¥J²Ó
ReDim Preserve aryCBs(1 To cCBs)
ReDim ³¯­z¦¡ ¦bµ{§Ç¼h¦¸¤¤¥Î¨Ó­«·s°t¸m°ÊºA°}¦CÅܼƪºÀx¦sªÅ¶¡¡C
  1. cCBs = cCBs + 1
  2. ReDim Preserve aryCBs(1 To cCBs) ' aryCBs(1  To 1) ¥u¦³¦³1¤¸¯À
½Æ»s¥N½X
  1. cCBs = cCBs + 1
  2. ReDim Preserve aryCBs(0 To cCBs) ' aryCBs(0  To 1) ¦³2¤¸¯À ¦h¤@¤¸¯À      
½Æ»s¥N½X
  1. ReDim Preserve aryCBs(0 To cCBs) ' aryCBs(0  To 0)  ¥u¦³¦³1¤¸¯À
  2. cCBs = cCBs + 1    '¥[¤W1¤¸¯À
½Æ»s¥N½X
  1. ReDim Preserve aryCBs(1 To cCBs) '  aryCBs(1  To 0)    ·|¦³¿ù»~
  2. cCBs = cCBs + 1
½Æ»s¥N½X





Åwªï¥úÁ{ ³Â»¶®a±Ú°Q½×ª©ª© (http://forum.twbts.com/)