當前位置:編程學習大全網 - 編程軟體 - vb如何正確計算閏年?

vb如何正確計算閏年?

Public Function ValiText(KeyIn As Integer, ValidateString As String, Editable As Boolean) As Integer

Dim ValidateList As String

Dim KeyOut As Integer

If Editable = True Then

ValidateList = UCase(ValidateString) & Chr(8)

Else

ValidateList = UCase(ValidateString)

End If

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

KeyOut = KeyIn

Else

KeyOut = 0

Beep

End If

ValiText = KeyOut

End Function

Private Sub Text1_KeyPress(KeyAscii As Integer)

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

End Sub

ValiText(KeyAscii, 這裏是準許輸入的字符, True=支持退格)

這個看似復雜,其實是個通用的

Public Function ValiText(KeyIn As Integer, ValidateString As String, Editable As Boolean) As Integer

這個是個函數,妳復制到妳的程序裏就可以了

然後在妳需要限制輸入內容 的文本框的 KeyPress 事件裏調用這個函數 就OK啦~

調用代碼就

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

這麽壹句

  • 上一篇:我可以從開心農場300提取現金嗎?
  • 下一篇:探界者ESP怎麽使用
  • copyright 2024編程學習大全網