Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If Char.IsDigit(e.KeyChar) Or e.KeyChar = "." Or e.KeyChar = Chr(8) Then
            If e.KeyChar = "." And InStr(TextBox1.Text, ".") > 0 Then
                e.Handled = True
            Else
                e.Handled = False
            End If
        ElseIf e.KeyChar = "-" And TextBox1.Text = "" Then
            e.Handled = False
        Else
            e.Handled = True
        End If
    End Sub

創作者介紹

歡迎~ 程式設計 學生 作業 專題製作 程式外包 家教...

goodlucky 發表在 痞客邦 PIXNET 留言(0) 人氣()