當前位置:編程學習大全網 - 網絡軟體 - valist

valist

'╱*計算總價按鈕代碼*╱

Private Sub Command1_Click()

Dim Num As Long

Dim Sum As Single, Price As Single

Price = Val(Text1.Text)

Sum = Val(Text2.Text)

Sum = Price * Sum

Label4.Caption = Sum

End Sub

'╱*退出按鈕代碼*╱

Private Sub Command2_Click()

Unload Me

End Sub

'╱*限制文本只能輸入數字和小數點以及使用退格鍵*╱

Private Sub Text1_KeyPress(KeyAscii As Integer)

KeyAscii = ValiText(KeyAscii, "0123456789.", False, True)

End Sub

'╱*限制文本只能輸入數字和小數點以及使用退格鍵*╱

Private Sub Text2_KeyPress(KeyAscii As Integer)

KeyAscii = ValiText(KeyAscii, "0123456789.", False, True)

End Sub

'----------------------

'限制文本輸入加強版

'----------------------

Function ValiText(KeyIn As Integer, ValiStr As String, BackSpace As Boolean, IncludeStr As Boolean) As Integer

Dim ValiList As String

Dim KeyOut As Integer

If BackSpace = False Then

ValiList = UCase(ValiStr) & Chr(8)

Else

ValiList = UCase(ValiStr)

End If

If IncludeStr = False Then

If InStr(1, ValiList, UCase(Chr(KeyIn)), 1) > 0 Then

KeyOut = 0

Else

KeyOut = KeyIn

End If

Else

If InStr(1, ValiList, UCase(Chr(KeyIn)), 1) > 0 Then

KeyOut = KeyIn

Else

KeyOut = 0

End If

End If

ValiText = KeyOut

End Function

  • 上一篇:xvideo軟件壹直顯示有病毒
  • 下一篇:qvodextenddll
  • copyright 2024編程學習大全網