Send a KeyPress Event to a Windows Form


/ Published in: C#
Save to your folder(s)

This was obvious once I found the class responsible, but took quite a bit of searching to locate. MSDN article has the code strings for the non-visible characters.


Copy this code and paste it in your HTML
  1. private void btnDeleteRows_Click(object sender, System.EventArgs e)
  2. {
  3. dataGrid1.Focus();
  4. SendKeys.Send("{DELETE}");
  5. }

URL: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsSendKeysClassTopic.asp

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.