Sub NumPressed(KeyAscii,refObj,Max,Dec) KpadAcc = Split(refObj.Text, ".") key=Chr(KeyAscii) If KeyAscii<46 Or KeyAscii>57 Or KeyAscii=47 Or Dec=0 And KeyAscii=46 Then KeyAscii.Value = 8 Else refObj.Text=Replace(refObj.Text,refObj.SelText,Empty) If refObj.Text = Empty And key = "." Then KeyAscii.Value = 8 refObj.Text="0." End If If refObj.Text = "0" And key <> "." Then KeyAscii.Value = 8 refObj.Text = key End If If InStr(refObj.Text, ".")<>0 Then If key = "." Or Len(KpadAcc(UBound(KpadAcc))) => Dec Then KeyAscii.Value = 8 End If End If If KeyAscii > 46 And KeyAscii <57 Then If CDbl(refObj.Text&key)>Max Then KeyAscii.Value = 8 refObj.Text=Max End If End If End If End Sub использовать с евентом keypressed, филтьр дает возможность в техтбокс вставить толико цифры и точку. филтьр работает но интересно почему KeyAscii определяется как обьект??
|