Code change for chars

G

Guest

Hi

i have the following code to only allow integer values to be entered in a textbox
Can anyone tell me how i can modify this to only allow characters?

Private Sub txtBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtBox1.KeyPres
'ensure that only integers can be entere
If Char.IsNumber(e.KeyChar) The
Exit Su
End I
If Not Char.IsNumber(e.KeyChar) The
e.Handled = Tru
End I
End Su
 
F

Fitim Skenderi

Depends what you mean with characters. If you mean characters as letters,
then you have a method in Char.IsLetter

Fitim Skenderi


Why/ said:
Hi,

i have the following code to only allow integer values to be entered in a textbox.
Can anyone tell me how i can modify this to only allow characters??

Private Sub txtBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtBox1.KeyPress
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top