Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Help .... im stuck

 

In vb6 I would have done

 

Select Case KeyCode

Case vbKeyF5

msgbox "123"

End Select

 

But I dont know how to do it in .net

 

Regards

 

Nick

  • Administrators
Posted (edited)
Private Sub Form1_KeyDown(ByVal sender  As Object, e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

Select Case e.KeyCode
   Case Keys.F5
       messagebox.Show("F5 was pressed");
End Select

End Sub

Edited by PlausiblyDamp

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

Hello mate,

 

For some reason that only works on a blank form. The moment i start putting objects on it, it doesnt work anymore. Almost like the form isnt on top anymore.

 

Any ideas?

 

Regards,

 

Nick

Posted
You have to set the forms KeyPreview property to True. Then it will process all keypresses for it's child controls too.

TT

(*_*)

 

There are 10 types of people in this world;

those that understand binary and those that don't.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...