Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to make keypress event in datagrid

Status
Not open for further replies.

bantakiah

Programmer
Oct 1, 2006
48
ID
1. if i press return on data grid it will move to next record
2. what ascii number for alt in vb
 
when enter is pressed it will move to the next column until it reaches the last one which is 4, in that case, it will move to the next row.

Case 13
.Col = .Col + 1
If .Col = 4 Then
.Row = .Row + 1
.Col = 0
End If
 
for my combobox i want to deny all change in key press except atl for access the drop down i use key down but alt is also deny
 
Something like this maybe?

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 18 Then '18 = alt
        Combo1.SetFocus
    Else
    End If
End Sub

Also to show key codes just set your Forms KeyPreview
Property to true, add a textbox to form
in the forms keydown event place:

Text1.Text = KeyCode

 
The KeyDown (and KeyUp) events both return a Shift argument. Its value is the logical OR of 1 for Shift, 2 for Control and 4 for Alt. Check VBHelp for KeyDown event for more detail

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top