.

.

Sunday, June 1, 2014

Mencegah Karakter Huruf Masuk Ke Textbox

11:32 AM

Mencegah Karakter Huruf Masuk Ke Textbox


Double klik textbox , lalu ganti evant menjadi keypress.
Masukkan Koding di bawah ini :

        If Not Char.IsNumber(e.KeyChar) And Not Char.IsControl(e.KeyChar) Then
            e.Handled = True
            'Show messagebox indicating error
            MessageBox.Show("Text ini hanya untuk nomor", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End If

Semua Koding :

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If Not Char.IsNumber(e.KeyChar) And Not Char.IsControl(e.KeyChar) Then
            e.Handled = True
            'Show messagebox indicating error
            MessageBox.Show("Text ini hanya untuk nomor", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End If
    End Sub



Semoga bermanfaat

Written by

We are Creative Blogger Theme Wavers which provides user friendly, effective and easy to use themes. Each support has free and providing HD support screen casting.

0 comments:

Post a Comment

 

© 2013 CYBER_HUNTER. All rights resevered. Designed by Templateism

Back To Top