- ©«¤l
- 231
- ¥DÃD
- 55
- ºëµØ
- 0
- ¿n¤À
- 293
- ÂI¦W
- 0
- §@·~¨t²Î
- winxp
- ³nÅ骩¥»
- office2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- KEELUNG
- µù¥U®É¶¡
- 2010-7-24
- ³Ì«áµn¿ý
- 2018-8-28
|
[µo°Ý] ¦p¦óÅýªí³æª«¥ó¹ïÀ³¨ìª«¥óÃþ§O¤º©O¡H
¦U¦ì¤j¤j¦n¡G
p-1.rar (12.66 KB)
¤p§Ì¹ïª«¥óÃþ§O«ÜµÛ°g¡A
¦ý¦b¾Ç²ß¹Lµ{¤@ª½¸I¾À¡C
²{¤p§ÌºNÀÀ¤@°ÝÃD¦p¤U
¤@¡B·s¼Wªí³æ¤º§tTEXTBOX1
¤ÎCOMMANDBUTTON1
Option Explicit
Dim mycls1 As mClass1
Private Sub CommandButton1_Click()
With mycls1
.test2 mycls1 '¥Ñ¦¹¥i°õ¦æ¡A¦Ó§ï¥Ñ¦b MCLASS1ªºMCMD1_CLASS·|¥X²{ERROR
End With
End Sub
Private Sub UserForm_Initialize()
Set mycls1 = New mClass1
With mycls1
Set .Txt1 = Me.Controls("TextBox1")
Set .Cmd1 = Me.Controls("CommandButton1")
.mTxt1 = "test"
End With
End Sub
¤G¡B·s¼W¤GÓª«¥óÃþ§O
--- MCLASS1 ---
Option Explicit
Public myCls2 As mClass2
Public WithEvents mTxt1 As MSForms.TextBox
Public WithEvents mCmd1 As MSForms.CommandButton
Public Property Set Txt1(setTxt1 As MSForms.TextBox)
Set mTxt1 = setTxt1
End Property
Public Property Set Cmd1(setCmd1 As MSForms.CommandButton)
Set mCmd1 = setCmd1
End Property
Private Sub Class_Initialize()
Set myCls2 = New mClass2
End Sub
Private Sub mCmd1_Click()
'myCls2.mTest mycls1
test2 mClass1 '¤GºØ¤è¦¡·|¥X²{°õ¦æ¶¥¬q¿ù»~'424' ¦¹³B¶·nª«¥ó
End Sub
Function test2(ByVal mycls1 As mClass1)
myCls2.mTest mycls1
End Function
--- MCLASS2 ---
Option Explicit
Sub mTest(ByVal mycls1 As mClass1)
Dim mStr As String
With mycls1
mStr = .mTxt1
End With
End Sub
½Ð°ÝÀ³¦p¦ó×§ï¦bMCLASS1ªºMCMD1_CLICK¼W³]MCLS1ª«¥ó©O¡H
·P®¦¦U¦ì¤j¤j¡I |
|