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

[µo°Ý] ½Ð±Ð Label »P Combobox ¹ïÀ³Åª¨ú

[µo°Ý] ½Ð±Ð Label »P Combobox ¹ïÀ³Åª¨ú

°ÝÃD¡G
­Y¥¼¦b userform ¤W¹w¥ý³]©w label »P combobox ¨âª«¥óªº¸Ü
­n¦p¦ó§PÂ_ ·í combobox ¼Æ­ÈÅÜ°Ê ( ¦p text ±q 1 Åܰʦܠ 2 )
label ªº caption ¤]¸òµÛÅÜ°Ê¡H


¥H¤Uµ{¦¡½X
  1. Private Sub UserForm_Initialize()
  2.   
  3.     Dim myForm1
  4.     Dim myLabel1 As MSForms.Label
  5.     Dim mycom As MSForms.ComboBox
  6.    
  7.     Set mycom = UserForm1.Controls.Add("forms.combobox.1")
  8.     With mycom
  9.         .Top = 100
  10.         .Left = 10
  11.         For su = 1 To 30
  12.             .AddItem (su)
  13.         Next
  14.     End With
  15.    
  16.     '°ÊºA·s¼WLabel±±¥ó
  17.     Set myLabel1 = _
  18.             UserForm1.Controls.Add("forms.Label.1")
  19.     '³]¸m¸ÓLabelªº¦WºÙ¡B°ª«×¡B¼e«×¡B¦ì¸mµ¥
  20.     With myLabel1
  21.          .Left = 10
  22.          .Top = 10
  23.          .Width = 50
  24.          .Height = 50
  25.          .BackColor = 201
  26.          .Caption = mycom.Text
  27.     End With
  28. End Sub
½Æ»s¥N½X

  ¦h°µ¦h·Q¦h¾Ç²ß¡A¤Ö¬Ý¤Ö¿ù¤Ö°g³~

  ¦h°µ=¦h¦h½m²ß¡A¦h¦h½s¼g¡C
  ¦h·Q=·Q·Q¬°¤°»ò¤H®aµ{¦¡­n¨º¼Ë¼g¡A¦pªG´«¦¨¦Û¤v¡A¤S·|«ç¼g¡C
  ¦h¾Ç²ß=¾Ç²ß¤H®aªºµo°Ý¨Ã¸Ñµª¡A¾Ç²ß¤H®aªº¼gªk

  ¤Ö¬Ý=¥u¬Ý¤£°µ¤]ªPµM

¥»©«³Ì«á¥Ñ GBKEE ©ó 2012-12-18 12:47 ½s¿è

¦^´_ 1# mark15jill
¨Ï¥Î [ª«¥óÃþ§O¼Ò²Õ]

  1. Option Explicit
  2. Dim XClass As New Class1          '·sªº [ª«¥óÃþ§O¼Ò²Õ]
  3. Public myLabel1 As MSForms.Label  '»Ý³]¬°¤½¥Î:ª«¥óÃþ§O¼Ò²Õªºµ{¦¡¤~¥i¥Î¨ì
  4. Private Sub UserForm_Initialize()
  5.     Dim myForm1, su As Variant
  6.     'Dim myLabel1 As MSForms.Label   'µù¸Ñ±¼
  7.     Dim mycom As MSForms.ComboBox
  8.     Set mycom = UserForm1.Controls.Add("forms.combobox.1")
  9.     Set XClass.CoBoX = mycom
  10.     With mycom
  11.         .Top = 100
  12.         .Left = 10
  13.         For su = 1 To 30
  14.             .AddItem (su)
  15.         Next
  16.     End With
  17.     '°ÊºA·s¼WLabel±±¥ó
  18.     Set myLabel1 = _
  19.             UserForm1.Controls.Add("forms.Label.1")
  20.             '³]¸m¸ÓLabelªº¦WºÙ¡B°ª«×¡B¼e«×¡B¦ì¸mµ¥
  21.     With myLabel1
  22.          .Left = 10
  23.          .Top = 10
  24.          .Width = 50
  25.          .Height = 50
  26.          .ForeColor = vbWhite
  27.          .BackColor = vbBlue
  28.          .Caption = mycom.Text
  29.     End With
  30. End Sub
½Æ»s¥N½X
  1. Option Explicit
  2. Public WithEvents CoBoX As MSForms.ComboBox
  3. Private Sub CoBoX_Change()
  4.     UserForm1.myLabel1.Caption = CoBoX
  5. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤Ñ¤W³Ì¬ü¬O¬P¬P¡A¤H¥Í³Ì¬ü¬O·Å±¡¡C
ªð¦^¦Cªí ¤W¤@¥DÃD