cNumberTextBox.cls
资源名称:IE_VB.rar [点击查看]
上传用户:davilee3
上传日期:2015-04-22
资源大小:986k
文件大小:1k
源码类别:
浏览器
开发平台:
Visual Basic
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- Persistable = 0 'NotPersistable
- DataBindingBehavior = 0 'vbNone
- DataSourceBehavior = 0 'vbNone
- MTSTransactionMode = 0 'NotAnMTSObject
- END
- Attribute VB_Name = "cNumberTextBox"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = False
- Option Explicit
- Private WithEvents mTextBox As TextBox
- Attribute mTextBox.VB_VarHelpID = -1
- Private mTextVal As Long
- Private Sub mTextBox_Change()
- mTextVal = Val(mTextBox.Text)
- End Sub
- Private Sub mTextBox_GotFocus()
- mTextBox.SelStart = 0
- mTextBox.SelLength = Len(mTextBox.Text)
- End Sub
- Private Sub mTextBox_KeyPress(KeyAscii As Integer)
- Dim tCanPress As Boolean
- tCanPress = KeyAscii >= 48 And KeyAscii <= 57
- tCanPress = tCanPress Or KeyAscii = 8
- If Not tCanPress Then
- KeyAscii = 0
- End If
- End Sub
- Public Property Let NumberTextBox(nTextBox As TextBox)
- Set mTextBox = nTextBox
- With nTextBox
- '.Alignment = vbRightJustify
- '.MaxLength = 9
- .Text = "1"
- '.FontName = "System"
- '.fontSize = "12"
- .Appearance = 0
- End With
- End Property
- Public Property Get NumberTextBox() As TextBox
- Set NumberTextBox = mTextBox
- End Property
- Public Property Get TextVal() As Long
- TextVal = mTextVal
- End Property