My problem :When I put one digite then the text box becomes read-only, i want to enterd only 4 digite ..
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar Like "[0_9]" Or Asc(e.KeyChar) Like 8 Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If Not TextBox1.Text = "" Then
TextBox1.ReadOnly = True
Else
TextBox1.ReadOnly = False
End If
End Sub
This post has been edited by marwaa: 03 December 2011 - 06:55 AM

New Topic/Question
Reply




MultiQuote




|