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

[µo°Ý] ¦p¦ó§Q¥Î°j°éª½±µ§ïLabel ªºname?(¤w¸Ñ¨M)

[µo°Ý] ¦p¦ó§Q¥Î°j°éª½±µ§ïLabel ªºname?(¤w¸Ñ¨M)

¥»©«³Ì«á¥Ñ icestormer ©ó 2012-5-7 08:41 ½s¿è

§Ú¦³¤j¬ù53­Ólabel16 -label53 §Ú·Q§Q¥Î°j°é ª½±µ§âname §ï¦¨ label16>>LB1 ¤@©y¨ìLB53


¦ý§Úµo²{§ï¤£©O, §ï¥¦ªºcaption ­Ë¥i¥H ¤£ª¾­n«ç¼g©O?
Sub §ï¦W()

  For i = 1 To 53
   
         §Úªºªí³æ.Controls("Label" & i + 15).Name

  Next
  
  End Sub

¦^´_ 14# Hsieh


       ·PÁ ¤G¦ì¶Wª©^^ ¨Ó¥h¸Õ¬Ý¬Ý
§Ö¥i¥H¦³Åv­­¤U¸ü¤F. ¨ì®É¥h¤U¸üª©¤W¥ý¶i¤À¨ÉªºVBA¾Ç²ßÀÉ®× ¦n¦n¾Ç²ß

TOP

¦^´_ 13# icestormer

­pºâª«¥ó¼Æ¶q¡A¥HTypeName¨Ó§PÂ_¬O­þ¤@ºØ±±¨î¶µ
  1. Private Sub CommandButton3_Click()
  2. Dim Ct As Control
  3. For Each Ct In Controls
  4.   If TypeName(Ct) = "Label" Then cnt = cnt + 1
  5. Next
  6. MsgBox cnt
  7. End Sub
½Æ»s¥N½X
­nÅã¥Ü3¦C7Äæ¸ê®Æ¡A¤@Äæ¦C¼Æ°µ°j°é
  1. Sub ex()
  2. Dim ar(1 To 3, 1 To 7)
  3. For i = 1 To 3 '3¦C
  4.   For j = 1 To 7 '7Äæ
  5.      k = k + 1 '­È
  6.      ar(i, j) = k '±N­È¼g¤J°}¦C
  7.   Next
  8. Next
  9. For i = 1 To 3 '´`¦C°j°é
  10.    m = Join(Application.Index(ar, i), ",") '¨ú¥X¤@¦C
  11.    mystr = IIf(mystr = "", m, mystr & Chr(10) & m) '¦êÁp¦r¦ê
  12. Next
  13. MsgBox mystr 'Åã¥Ü¦r¦ê
  14. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ icestormer ©ó 2012-5-6 22:28 ½s¿è

¦^´_ 12# GBKEE


    ·PÁ§A ¸g­è¤~¸Õ¤F±zªºµ{¦¡½X §¹¥þ¥i¥H¥Î¤F

¤£¹L·Q°Ý¥t¤@­Ó°ÝÃD ¦pªG ¤£¥Îfor next¥i¥H§ï¥Îfor each  X  in Label ¤§Ãþªº??
´N¬O¦pªG¦Û­qªí³æ¤W ¦³
TextBox 5­Ó
Label  10­Ó
commandbutton 6­Ó

§Ú¥i¥H§Q¥Îfor each °w¹ï Label  ²Î­p¤@¦@¦³¦h¤Ö­ÓLabel ?

sub commandbutton_click() <<¥Ø«e¥u·|³o­Ó¦Ó¤w,¦ý¥L¥u·|­pºâ¥þ³¡ªº±±¨î¶µ¦³¦h¤Ö©O.
for each  x in controls

     i=i+1
next
msgobx  "¤@¦@¦³¦h¤Ö:" & i & "±±¨î¶µ"

end sub
================================================================
·Q¦A°Ý±z¤@­Ó°ÝÃD¦pªG§Ú·Q§Q¥ÎÂù°j°é¼g¥X ¦p¤Uªº±Æ§Ç ­n«ç¼g©O?«ç·Q³£·Q¤£¥X¨Ó..

1        2        3        4        5        6        7
8        9        10        11        12        13        14
15        16        17        18        19        20        21

TOP

¦^´_ 11# icestormer
ªí³æ¹ê»Ú¤W¤w¦s¦bªº±±¨î¶µ ¤~¥i¥Î  Label1.Caption = "´ú¸Õ"  
With Controls.Add("Forms.Label.1", , True)  ©Ò·s¼Wªº±±¨î¶µ ¤£¬O ªí³æ¹ê»Ú¤W¤w¦s¦bªº±±¨î¶µ
  1. Sub Ex()
  2.     Dim I As Integer
  3.     Controls("Label1").Caption = "´ú¸Õ"
  4.     For I = 1 To 21
  5.         Controls("Label" & I).Visible = False
  6.     Next
  7.    
  8. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ icestormer ©ó 2012-5-6 09:33 ½s¿è

¦^´_ 9# Hsieh


    ­è¤~ªºµ{¦¡§¹¥þ¥i¥H¨Ï¥Î¦ý§Ú¦³¤G­Ó°ÝÃD ÁÙ¬O¤£À´ ·Q½Ð°Ý¶Wª©


§Ú¦pªG§âµ{¦¡§ï¦¨³o¼Ë

Private Sub UserForm_Initialize()
'·s¼W2Äæ8¦C
For j = 1 To 2
k = 0
    For i = 1 To 10
    k = k + 1
      With Controls.Add("Forms.Label.1", , True)'¤£§ï¥¦NAME Åý¥¦¥ÑLabel1 -21
      .Caption = .Name
         .Top = 20 * (i - 1) + 5
         .Left = 160 * (j - 1) + 5
         .Width = 155
         .Height = 18
         ComboBox1.AddItem .Name
      End With
    Next
Next
End Sub

µM«á§Ú¥t¥~§Ë¤@­ÓCMD ¤º®e¬O

Label1.caption ="´ú¸Õ" <<·|¥¢±Ñ§ä¤£¨ìª«¥ó
----------------------------------------------------------------------------------------------------------------------------
¦ý¦pªG§Ú¬O¥ý¨Æ¦bªí³æ¤W ¥ý©Ô¥X¤@­ÓLAbel1«á

³o®É¥Ñ¤WÀYµ{¦¡½X²£¥ÍªºLabel 1-21 >Åܦ¨>Label2-21
§Ú¦A«öCMD ªº¥¨¶° Óý¬O¥i¥H§ïÅÜLable1.caption

³o¬O¬°¤°»ò©O? µ{¦¡¥Í¦¨ªºLabel1 ¬°¦ó¨Sªk§Q¥Î Label1.caption ="´ú¸Õ" ¨Ó§ïÅÜ¥¦©O?¦ý¨Æ¥ý©Ô¦bªí³æ¤WªºLabel1.caption Óý¥i¥H?¹ê¦b¤£À´©O
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
²Ä¤G°ÝÃD¬O.

¹³µ{¦¡½X¥Í¦¨ ¥X Label1 -21 ³o³¡¥÷¥i¥H§Q¥Î°j°é §â¥¦­Ì¤@¦¸³£³]©w¦¨visible=false? ¬O­n§Q¥Îtabindex ¶Ü? ÁÙ¬O­n¦p¦ó¼g©O?

TOP

¦^´_ 9# Hsieh


   Á ¶Wª©  ¨Ó¥h¸Õ¬Ý¬Ý

TOP

¦^´_ 8# icestormer
ªí³æª«¥ó¥u¯à¥ÎÁôÂ䣯à§R°£
  1. Private Sub CommandButton1_Click()
  2. If ComboBox1 = "" Then Exit Sub
  3. Me.Controls(ComboBox1.Text).Visible = False  '.Caption = "ar"
  4. ComboBox1.RemoveItem ComboBox1.ListIndex
  5. ComboBox1 = ""
  6. End Sub

  7. Private Sub CommandButton2_Click()
  8. Me.Controls(ComboBox1.Text).Caption = TextBox1
  9. End Sub

  10. Private Sub UserForm_Initialize()
  11. '·s¼W2Äæ8¦C
  12. For j = 1 To 2
  13. k = 0
  14.     For i = 1 To 10
  15.     k = k + 1
  16.       With Controls.Add("Forms.Label.1", "LA" & k & "_" & 10 - k + 1 & "_" & j, True)
  17.       .Caption = .Name
  18.          .Top = 20 * (i - 1) + 5
  19.          .Left = 160 * (j - 1) + 5
  20.          .Width = 155
  21.          .Height = 18
  22.          ComboBox1.AddItem .Name
  23.       End With
  24.     Next
  25. Next
  26. End Sub
½Æ»s¥N½X
play.gif
¬¡­¶Ã¯1.rar (11.24 KB)
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ icestormer ©ó 2012-5-5 21:32 ½s¿è

°ÝÃD1.rar (6.87 KB) ¦^´_ 6# Hsieh



½Ð°Ý¶Wª©  §Ú¥Î¤U¦Cµ{¦¡½X¦b¦Û­qªí³æ¤W ¥Í¥X³o¨Çlabel  ¨º­n«ç¦b¥t¤@­Ó«öÁä (§ïÅÜ)¤¤ §ïÅÜLA0ªºCAPTION©O? ³£¤@ª½»¡ §ä¤£¨ìª«¥ó

¥t¥~ ¦pªG·Q§R°£³z¹Lµ{¦¡½X¥Í¦¨ªº±±¨î¶µ(¹³¬OLabel)¤S­n«ç¼g©O??
    Private Sub CommandButton2_Click()
For j = 0 To 32
              For i = 0 To 6           
                With Controls.Add("Forms.Label.1", "LA" & j + i, True)'½Ð°Ý³o¦æ¤¤ªº TRUE ¬O¤£¬O«ü ­nÅã¥Üªº·N«ä?
                   .Caption = .Name
                   .Font.Size = 12
                   .BorderStyle = 1
                   .ForeColor = &H80000012
                   .Top = 42 + (j * 14)
                   .Left = i * 70
                   .Width = 70
                   .Height = 16
                   .TextAlign = 3
             end with
    next  i
next j
=======================================================
¥t¥~¤£ª¾­n«ç¼g°j°é¯àªí²{¥X¤U¤è³oºØ±¡ªp©O?

¸Õ¤F¦n¤[¦ý³£¸Õ¤£¥X¨Ó ¹³¤U¤èªºµ{¦¡½X«ç­n«ç¼g. ¥ÎÂù°j°é ¤]¼g¤£¥X¨Ó

1ªº10
2ªº9
3ªº8
4ªº7
5ªº6
6ªº5
7ªº4
8ªº3
9ªº2
10ªº1

TOP

¦^´_ 6# Hsieh


   Á ¶Wª© ¨Ó¥h¸Õ¬Ý¬Ý^^

TOP

        ÀR«ä¦Û¦b : ¤£­nÀH¤ß©Ò±ý¡A­nÀH¤ß±Ð¨|¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD