Class天杀的那2行~这个范例救了我~
只需1行~TMD1行~想了我几个礼拜~问了多少人~没人愿意说~都要我改用属性写~但是要改成属性写~我原本的代码要大翻修~实在是艰辛~其实说穿了~就只加1行~1行阿
...............................天阿~天杀的那1行~其他我都写了~差那1行就是不会动~
贴个范例~
程序代码:
类别1里的代码: Option Explicit Public Event MyMessageBox(ByVal Today As String) Public Function AskToday() RaiseEvent MyMessageBox("Today is " & Date) End Function
Form1上有个按钮
程序代码:
Option Explicit Private WithEvents oClass1 As Class1 Private Sub Command1_Click() oClass1.AskToday End Sub Private Sub Form_Load() Set oClass1 = New Class1 End Sub Private Sub Form_Unload(Cancel As Integer) Set oClass1 = Nothing End Sub Private Sub oClass1_MyMessageBox(ByVal Today As String) '就是这一行~ MsgBox Today, vbInformation, "Message" End Sub
[ 本帖最后由 wube 于 2011-5-12 19:45 编辑 ]