KeyPress Event on DataGrid Not Firing?

B

Bruce D

I've tried to Google for the answer...and I'm sure it's something
stupid...but for some reason if I try something as simple as this...I never
see a messagebox. I have created the columns programmatically using
'DataGridTextBoxColumn' and such. I can click on the colums and type over
what is displayed.

Any ideas?

Private Sub DataGrid1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles DataGrid1.KeyPress
' MsgBox(e.KeyChar.ToString)
MessageBox.show("Hello")
End Sub


TIA
-bruce
 
B

Bruce D

Nevermind. I am slow today! Maybe being new to VB.NET doesn't help.

I found that the problem was that the textboxes have control and not the
grid...so I had to create keypress handlers for the texboxes inside the grid
and then it works.

Sorry to waste the posting space! Next time I'll wait until Tuesday :)

-bruce
 

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