Private Sub mvarTB_Change()
Static InhibitFlag As Boolean
Dim DP As Long
Dim mike As Boolean
mike = True
If Not InhibitFlag Then
Select Case False
'mha 07.03.2003 Auch < > = zulassen
Case key = 60 To 62 Or IsNumeric(mvarTB.Text)
Select Case mvarTB.Text
Case "-", "+"
SetSelStart mvarTB.SelStart
Case Else
If Len(mvarTB.Text) > 0 Then
InhibitFlag = True
' bisherigen Zustand der Textbox wieder herstellen
mvarTB.Text = mBuffer
InhibitFlag = False
SetSelStart mSelStart
End If
End Select
Case Else
DP = InStr(mvarTB.Text, Chr$(mDP))
If DP > 0 Then
If (mvarDecimalesAllowed = False) Or _
(Len(Mid$(mvarTB.Text, DP + 1)) > mvarNumDecimales) Then
InhibitFlag = True
mvarTB.Text = mBuffer
InhibitFlag = False
SetSelStart mSelStart
End If
Else
SetSelStart mvarTB.SelStart
End If
End Select
mBuffer = mvarTB.Text
End If
End Sub
Private Sub mvarTB_KeyDown(KeyCode As Integer, Shift As Integer)
SetSelStart mvarTB.SelStart
End Sub
Private Sub mvarTB_KeyPress(KeyAscii As Integer)
key = KeyAscii
Select Case KeyAscii
Case 13
' Taste Return (Enter)
Case Is < 32, 43, 45, 48 To 57, 60 To 62
Case mDP
If mvarDecimalesAllowed Then
If InStr(mvarTB.Text, Chr$(mDP)) Then
KeyAscii = 0
End If
Else
KeyAscii = 0
End If
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub mvarTB_KeyUp(KeyCode As Integer, Shift As Integer)
SetSelStart mvarTB.SelStart
End Sub
Private Sub mvarTB_MouseDown(Button As Integer, Shift As Integer, X As Single, _
Y As Single)
SetSelStart mvarTB.SelStart
End Sub
Private Sub Class_Initialize()
Set enumCtrl = New Collection
' Dezimaltrennzeichen lt. Ländereinstellung
mDP = Asc(Format$(0, "."))
mvarDecimalesAllowed = True
End Sub
Private Sub Class_Terminate()
Set enumCtrl = Nothing
Set mvarTB = Nothing
End Sub
Public Sub Add(item As Variant, Optional ByVal key As String)
enumCtrl.Add item, key
End Sub
Public Function Remove(Index As Variant)
enumCtrl.Remove Index
End Function
Public Property Get Count() As Long
Count = enumCtrl.item(Index)
End Property
Public Function NewEnum() As IUnknown
Set NewEnum = enumCtrl.[_NewEnum]
End Function Was muss ich jetzt machen? Wie initialisiere ich die Klasse, wie hänge ich die Textboxen an?
Übrigens: Bei der Funktion NewEnum() as IUnkonwn hat er das IUnknown nicht gekannt... Muss ich da noch irgendwelche Verweise setzen?
Sorry, ich hab echt den Überblick verloren!!
Vielen herzlichen Dank!
Gruss Michael |