ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] checkbox&optionbutton­È°ÝÃD

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2014-12-16 11:14 ½s¿è

¦^´_ 1# ayubbs
1.
  1. Private Sub CommandButton1_Click()
  2.   Dim s As String, i As Long
  3.   For i = 1 To 4
  4.     With Controls("CheckBox" & i)
  5.       If .Value Then
  6.         s = IIf(s = "", .Caption, s & ";" & .Caption)
  7.       End If
  8.     End With
  9.   Next
  10.   TextBox1.Value = s
  11. End Sub

  12. Private Sub CommandButton2_Click()
  13.   TextBox1.Value = ""
  14. End Sub
½Æ»s¥N½X
2.
  1. Private Sub OptionButton1_Click()
  2.   TextBox2 = OptionButton1.Caption
  3. End Sub
  4. Private Sub OptionButton2_Click()
  5.   TextBox2 = OptionButton2.Caption
  6. End Sub
  7. Private Sub OptionButton3_Click()
  8.   TextBox2 = OptionButton3.Caption
  9. End Sub
½Æ»s¥N½X
3.
  1. Private Sub CommandButton3_Click()
  2.   Dim i As Long
  3.   For i = 4 To 6
  4.     With Controls("OptionButton" & i)
  5.       If .Value Then
  6.         TextBox3.Value = .Caption
  7.         Exit For
  8.       End If
  9.     End With
  10.   Next
  11. End Sub
  12. Private Sub CommandButton4_Click()
  13.   TextBox3.Value = ""
  14. End Sub
½Æ»s¥N½X
4.
  1. Private Sub CheckBox5_Click()
  2.   UpdateTextBox4
  3. End Sub
  4. Private Sub CheckBox6_Click()
  5.   UpdateTextBox4
  6. End Sub
  7. Private Sub CheckBox7_Click()
  8.   UpdateTextBox4
  9. End Sub
  10. Private Sub CheckBox8_Click()
  11.   UpdateTextBox4
  12. End Sub

  13. Private Sub UpdateTextBox4()
  14.   Dim s As String, i As Long
  15.   For i = 5 To 8
  16.     With Controls("CheckBox" & i)
  17.       If .Value Then
  18.         s = IIf(s = "", .Caption, s & ";" & .Caption)
  19.       End If
  20.     End With
  21.   Next
  22.   TextBox4.Value = s
  23. End Sub
½Æ»s¥N½X
P.S.  
ÂI¿ïcheckbox¦³­ÓÄÝ©Ê¥sGroupName
ABC À³¸Ó³]¸m¦P¤@­ÓGroupName
¤j¤¤¤p ³]¸m¥t¤@­ÓGroupName
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

        ÀR«ä¦Û¦b : ¡i¬°µ½Ävª§¡j¤H¥Í­n¬°µ½Ävª§¡A¤À¬í¥²ª§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD