does anyone knows how to input letters and disable inputting an integer or number?... plsss help...tnx

If I understand you correctly, you have a text box and you only want to have letters in there, and not numbers.

How I would tackle the problem is to use the text1_change() and then get the last character that is entered and then use the isnumeric . If it is numeric, then remove it and maybe alert the user

private sub text1_change()
if isnumeric(right(text1,1)) = true then
    ' is a number
    text1 = left(text1, len(text1)-1)
    msgbox "No numbers allowed"
else
    'anything but a number
endif

end sub

u just to handle keychar.
try this following code :

Private Sub text1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles text1.KeyPress
        If (Microsoft.VisualBasic.Asc(e.KeyChar) < 65) _
              Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 90) _
              And (Microsoft.VisualBasic.Asc(e.KeyChar) < 97) _
              Or (Microsoft.VisualBasic.Asc(e.KeyChar) > 122) Then
            'space allowed
            If (Microsoft.VisualBasic.Asc(e.KeyChar) <> 32) Then
                e.Handled = True
            End If
        End If
        If (Microsoft.VisualBasic.Asc(e.KeyChar) = 8) Then
            e.Handled = False
        End If
    End Sub

Ok. Hope this helps..

ups... i was mistake here. there are code for vb.net.. :P.
this is code for vb 6, the logic is still same :

Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57, 8, 32
'Let these key codes pass through
Case 97 To 122, 8, 32
 'Let these key codes pass through
Case Else
'All others get trapped
KeyAscii = 0
End Select
End Sub

48-57 for a upper caption
97-122 for a lower caption
8 for backspace
32 for space
so just upper caption, lower caption, backspace and space will allowed to press, other key will not allow and not type in text box.

If I understand you correctly, you have a text box and you only want to have letters in there, and not numbers.

How I would tackle the problem is to use the text1_change() and then get the last character that is entered and then use the isnumeric . If it is numeric, then remove it and maybe alert the user

private sub text1_change()
if isnumeric(right(text1,1)) = true then
    ' is a number
    text1 = left(text1, len(text1)-1)
    msgbox "No numbers allowed"
else
    'anything but a number
endif

end sub

thank you sooooo much....=)

you're so great!!..i'm done with it..=)

another thing, do you know how to make randomizing questions in a frame, not to be repeated?..and

how to make objects animate...tnx

Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii > 64 And KeyAscii < 91) Or (KeyAscii > 96 And KeyAscii < 123) Then
Text1 = Text1
Else
KeyAscii = o
Beep
MsgBox " a To z and A To Z only"
End If              ' Tested akg suresh
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.