|
-
Mar 21st, 2000, 05:19 PM
#1
Thread Starter
New Member
hi,
I'd like to disable some key is keyboard such as ALT, TAB; or another, for forcing the user to tape a valid username and password before using some application in the computer.
thanks
-
Mar 21st, 2000, 08:37 PM
#2
Lively Member
You can start with this function and modify it to make restrict keys if you like. This function will only allow the user enter the Keys you specify on the keyboard.
Code:
Public Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = fnValiText
(KeyAscii,"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",True)
End Sub
Public Function fnValiText(arg_sKeyIn As Integer, arg_strValidateString As String, arg_bEditable As Boolean) As Integer
'Dim member variables
Dim m_strValidateList As String
Dim m_sKeyOut As Integer
If arg_bEditable = True Then
m_strValidateList = UCase(arg_strValidateString) & Chr(8)
Else
m_strValidateList = UCase(arg_strValidateString)
End If
If InStr(1, m_strValidateList, UCase(Chr(arg_sKeyIn)), 1) > 0 Then
m_sKeyOut = arg_sKeyIn
Else
m_sKeyOut = 0
End If
fnValiText = m_sKeyOut
End Function
-
Mar 21st, 2000, 10:57 PM
#3
PowerPoster
you can use this...
Private Sub Text1_KeyPress (KeyAscii As Integer)
If KeyAscii = 9 or KeyAscii = 18 then KeyAscii = 0
'Note KeyAscii 8 = TAB Key and KeyAscii 18 = Atl Key.
End Sub
-
Mar 23rd, 2000, 11:49 AM
#4
Addicted Member
Every body Uses keyascii but as per my Knowledge
KEYCODE Event is the best to trap Keys...
Because it traps even the Function keys....which is not possible with ascii....
use if condition and trap the keys
eg:- if keycode = vbkeyreturn then
----
End if
Try it
-
Mar 23rd, 2000, 12:18 PM
#5
Lively Member
KeyCode Event?
there's no KeyCode Event... BUT
KeyDown and KeyUp Events use KeyCode as one of their
parameters...
for example:
Private Sub Text1_KeyDown (KeyCode As Integer, Shift As Integer)
just a clarification...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|