17-09-20, 12:39 AM
(آخر تعديل لهذه المشاركة : 17-09-20, 12:48 AM {2} بواسطة Anas Mahmoud.)
بالاضافة لرد الاخ عاصم
الافضل الاستماع للحدث KeyPress لانه يتيح الحرف مباشرة عن طريق e.KeyChar
الافضل الاستماع للحدث KeyPress لانه يتيح الحرف مباشرة عن طريق e.KeyChar
كود :
Private Sub Form1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Me.KeyPress
If CheckBox1.Checked = True And Char.IsControl(e.KeyChar) = False Then
TextBox1.Text += e.KeyChar
e.Handled = True
End If
End Subكود :
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
KeyPreview = True
End Sub
