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

[µo°Ý] ¦p¦ó¦bmultipageªí³æ¤º±N¤å¦r¤è¶ôÃþ§O¶i¦æ¿é¤J­­¨î

[µo°Ý] ¦p¦ó¦bmultipageªí³æ¤º±N¤å¦r¤è¶ôÃþ§O¶i¦æ¿é¤J­­¨î

¦U¦ì¤j¤j¦n¡G

   ¤p§Ì¹ïª«¥óÃþ§O¼Ò²Õ¡A
¤@ª½µLªkÅé·|¨ä§t·N¡C

   ²{¤p§Ì·Q¤Þ¥Î¤@½d¨Ò¨Ã
µy°µ­×§ï¬°multipage¼Ò¦¡¦b¨ä
page1¤Îpage2¤º¦U¦³¤­­Ó
textbox¤å¦r¤è¶ô¡C

   ²{§Q¥ÎÃþ§O¼Ò²Õ¨Ó±N¤å¦r¤è¶ôÃþ§O¤Æ
¥H¶i¦æ¿é¤J­­¨î¡C

¤p§Ìµo²{¦bpage1¥i¹F¦¨¨ä¿é¤J­­¨î¡A
¦ý¦bpage2ªº¤å¦r¤è¶ô«o¤£¯à逹¨ä®ÄªG¡C
¤£ª¾¨ä­ì¦]¬°¦ó©O¡H
¥H¤U»yªk¦p¤U¡G

ªí³æ¡÷userform1
Private Sub UserForm_Initialize()

Select Case UserForm1.MultiPage1.Value
   
Case 0
    Dim i As Long
    ReDim myTb(1 To 5)
    For i = 1 To 5
        Set myTb(i) = New myTbClass
        Set myTb(i).Tb = Me.Controls("TextBox" & CStr(i))
    Next
    myTb(1).ck = 1
    myTb(2).ck = 2
    myTb(3).ck = 3
    myTb(4).ck = 2
    myTb(5).ck = 1


Case 1
    Dim j As Long
    ReDim myTb(6 To 10)
    For j = 6 To 10
        Set myTb(j) = New myTbClass
        Set myTb(j).Tb = Me.Controls("TextBox" & CStr(j))
    Next
    myTb(6).ck = 1
    myTb(7).ck = 2
    myTb(8).ck = 3
    myTb(9).ck = 2
    myTb(10).ck = 1
   
End Select
End Sub

module1

Sub ufshow()
    UserForm1.Show vbModeless   
End Sub

ª«¥óÃþ§O¼Ò²Õ¡÷myTbClass
Option Explicit

'Ãþ§O¼Ò²ÕmyTbClass
Private WithEvents myTb As MSForms.TextBox
Private myCkType As Long
Public Property Set Tb(setTb As MSForms.TextBox)
    Set myTb = setTb
End Property

Public Property Get Tb() As MSForms.TextBox
End Property

Public Property Let ck(setCk As Long)
    myCkType = setCk
End Property

Public Property Get ck() As Long
End Property

Private Sub myTb_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    Select Case myCkType
        Case 1
            '©Úµ´¼Æ¦r¥H¥~ªº¿é¤J
            If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then
                KeyAscii = 0: Beep
            End If
        Case 2
            '©Úµ´¼Æ¦r,"-"¥H¥~ªº¿é¤J
            If (KeyAscii >= Asc("0") And _
                KeyAscii <= Asc("9")) Or KeyAscii = Asc("-") Then
            Else
                KeyAscii = 0: Beep
            End If
        Case 3
            '©Úµ´¼Æ¦r,"­^¤å¤j¼g"¥H¥~ªº¿é¤J
            If (KeyAscii >= Asc("0") And KeyAscii <= Asc("9")) Or _
                (KeyAscii >= Asc("A") And KeyAscii <= Asc("Z")) Then
            Else
                KeyAscii = 0: Beep
            End If
    End Select
End Sub

ÁÂÁ¦U¦ì¤j¤j¡C

txtBox.rar (13.24 KB)

ÁÂÁª©¥D¤j¤j¡C

¤p§Ì¤w¦¬¨ìÀɮסC
¤p§Ì²Ä¤@¦¸±µÄ²¨ìª«¥óÃþ§O¼Ò²Õ¡A
¥Ø«eÁÙ¦A¬ã¨sª©¥D¤j¤j´£¨Ñ¤§½d¨ÒÀÉ¡C
¥u·Pı¨ä¬°¦ó¯à¦p¦¹¯«©_©O¡H


·P®¦¤j¤j¡G

TOP

¥»©«³Ì«á¥Ñ dechiuan999 ©ó 2010-10-11 05:49 ½s¿è

·PÁª©¥D¤j¤j¡C

¤p§Ì¦]¸ê¾ú©|²L¡AÁÙµLÅv­­¤U¸ü
½d¨ÒÀÉ¡C
¥i§_½Ðª©¥D¤j¤j¯àª½±µE-MAIL
µ¹¤p§Ì¡AÅý¤p§Ì¥ý¦³¿i½mªº¾÷·|¡C
E-MAIL ¡G[email protected]

·P®¦¤j¤j¡I

TOP

¦^´_ 3# dechiuan999
Property Get ³¯­z¦¡, Property Let ³¯­z¦¡,Property Set ³¯­z¦¡  §A¥i¸Ô¬ÝVBAªº»¡©ú
¦bª«¥óÃþ§O¨Æ¥ó¤@¯ëªº¨Ï¥Î¤è¦¡
1 ª«¥óÃþ§O¼Ò²Õ¤¤    Public WithEvents MySh As Worksheet ³]¬°¥~³¡¥iŪ¨úªºª«¥óÅܼÆ
    MySh ¦bª«¥óÃþ§O¼Ò²Õ¤¤ ·|¦³ª«¥ó¨Æ¥ó¥i¨Ï¥Î ¦p¹Ï:



2  Dim GetSh As New MyClass -> ¦bª«¥ó¸Ì«Å§i¤@ÅÜ¼Æ ¬°·sªºª«¥óÃþ§O¼Ò²Õ
   Set GetSh.MySh = Sheet1   ±NÃþ§O¼Ò²Õªºª«¥óGetShÅÜ¼Æ «ü©w¬° Sheet1
¦pÒæ¥ó ªºPrivate Sub CommandButton1_Click()
½Ð¬ÝªþÀÉ
Re-dechiuan999.rar (13.15 KB)

TOP

ÁÂÁª©¥D¤j¤j¡C

¤p§Ì¸ÕµÛ§ï¦ÜPrivate Sub MultiPage1_Change()
¤w¹F¦¨¹B§@¡C
¦ý¾ã­Ó»yªk¤p§Ì¦Ü¤µÁÙ¬OÃú¸Ì¬Ýªá¡AµLªk¥þµM²z¸Ñ¡C
¤£ª¾¯à§_½Ðª©¥D¤j¤jµy§@»¡©ú¡A¤]Åý¤p§Ì¯à¦³©Ò²z¸Ñ¡C
¤U¦C»yªk¦p¤U¡G
'Ãþ§O¼Ò²ÕmyTbClass
Private WithEvents myTb As MSForms.TextBox
Private myCkType As Long
Public Property Set Tb(setTb As MSForms.TextBox)
    Set myTb = setTb
End Property
Public Property Get Tb() As MSForms.TextBox
End Property

Public Property Let ck(setCk As Long)
    myCkType = setCk
End Property

Public Property Get ck() As Long
End Property

·P®¦¤j¤j¡I

TOP

¦^´_ 1# dechiuan999
Private Sub UserForm_Initialize() ³o¬Oªí³æÅã¥Ü¤§«eªºµ{¦¡³]©w
¦]¬° ªí³æÅã¥Ü§A³]©w«eUserForm1.MultiPage1.Value=0  (Page1)  ©Ò¥H¥u¦³ textbox 1 - 5 ¦³³]©w¨ì
½Ð±NPrivate Sub UserForm_Initialize() ¦WºÙ§ï¦¨ Private Sub MultiPage1_Change() ¸Õ¸Õ¬Ý

TOP

        ÀR«ä¦Û¦b : ¶¢¤HµL¼Ö½ì¡A¦£¤HµL¬O«D¡C
ªð¦^¦Cªí ¤W¤@¥DÃD