Click here to Skip to main content
16,005,826 members
Home / Discussions / C#
   

C#

 
GeneralDataGridView And DataTable.Select() Method Pin
half-life29-Mar-08 23:20
half-life29-Mar-08 23:20 
QuestionRe: DataGridView And DataTable.Select() Method Pin
fearless stallion30-Mar-08 20:12
fearless stallion30-Mar-08 20:12 
GeneralRe: DataGridView And DataTable.Select() Method Pin
half-life31-Mar-08 8:04
half-life31-Mar-08 8:04 
General[Message Deleted] Pin
jijophilip29-Mar-08 17:43
jijophilip29-Mar-08 17:43 
GeneralRe: Paint Application in C# Pin
MarkB77729-Mar-08 17:49
MarkB77729-Mar-08 17:49 
GeneralRe: Paint Application in C# Pin
jijophilip29-Mar-08 17:55
jijophilip29-Mar-08 17:55 
GeneralRe: Paint Application in C# Pin
MarkB77729-Mar-08 18:21
MarkB77729-Mar-08 18:21 
General"Shift" key Pin
jon-8029-Mar-08 9:22
professionaljon-8029-Mar-08 9:22 
I'm trying to capture the event where the user selects, say, Shift + 8 (hence * should be captured as a key).

The problem seems to be that the value for the '8' key ("D8") is retained whilst the value for the Shift keys ("LShiftKey" and "RShiftKey") are overwritten with the value "D8".

Would it be possible to use NativeMethods or System.Windows.Forms.Keys within this context?
E.g.
<pre>
if ((NativeMethods.GetKeyState(VK_SHIFT) &amp; 0x8000) != 0)
{
//SHIFT is pressed
sb.AppendLine("Shift is pressed.");
}
</pre>

I'm currently assuming a UK keyboard.

Any more ideas on how to go about it please?

D'Oh! | :doh:

<pre>
private void keyPressed_KeyIntercepted(ref KeyboardHook.KeyboardHookEventArgs e)
{

keyAndModifier[0] = e.KeyName; // D8
if (keyAndModifier[0] == null) // null value
{
keyAndModifier[1] = e.KeyName; //somehow needs to be set to "LShiftKey" or "RShiftKey", so that the code works
}
else
{
// do nothing
}

switch (e.KeyName)
{ //...
case "D8":
{
if (keyAndModifier[1] == "LShiftKey" || keyAndModifier[1]== "RShiftKey")
//does NOT work because code never reads the Shift keys
{
btnMultiply.PerformClick();
break;
}
else
{
btnEight.PerformClick();
break;
}
}
//...
}
</pre>

Jon
GeneralRe: "Shift" key Pin
Luc Pattyn29-Mar-08 10:31
sitebuilderLuc Pattyn29-Mar-08 10:31 
GeneralRe: "Shift" key Pin
jon-8029-Mar-08 11:13
professionaljon-8029-Mar-08 11:13 
GeneralRe: "Shift" key Pin
Luc Pattyn29-Mar-08 11:19
sitebuilderLuc Pattyn29-Mar-08 11:19 
GeneralRe: "Shift" key [modified] Pin
jon-8029-Mar-08 21:16
professionaljon-8029-Mar-08 21:16 
GeneralRe: "Shift" key Pin
Luc Pattyn30-Mar-08 0:43
sitebuilderLuc Pattyn30-Mar-08 0:43 
GeneralRe: "Shift" key Pin
Pete O'Hanlon30-Mar-08 10:25
mvePete O'Hanlon30-Mar-08 10:25 
GeneralRe: "Shift" key Pin
Luc Pattyn30-Mar-08 10:37
sitebuilderLuc Pattyn30-Mar-08 10:37 
GeneralRe: "Shift" key Pin
Pete O'Hanlon30-Mar-08 10:52
mvePete O'Hanlon30-Mar-08 10:52 
GeneralSQL query in c# Pin
Yevgeny Efter29-Mar-08 6:30
Yevgeny Efter29-Mar-08 6:30 
GeneralRe: SQL query in c# Pin
Giorgi Dalakishvili29-Mar-08 7:12
mentorGiorgi Dalakishvili29-Mar-08 7:12 
GeneralRe: SQL query in c# Pin
Yevgeny Efter29-Mar-08 7:17
Yevgeny Efter29-Mar-08 7:17 
GeneralRe: SQL query in c# Pin
Giorgi Dalakishvili29-Mar-08 7:22
mentorGiorgi Dalakishvili29-Mar-08 7:22 
GeneralRe: SQL query in c# Pin
Yevgeny Efter29-Mar-08 7:31
Yevgeny Efter29-Mar-08 7:31 
GeneralRe: SQL query in c# Pin
User 665829-Mar-08 7:55
User 665829-Mar-08 7:55 
GeneralRe: SQL query in c# Pin
Yevgeny Efter29-Mar-08 8:13
Yevgeny Efter29-Mar-08 8:13 
GeneralRe: SQL query in c# Pin
Luis Alonso Ramos29-Mar-08 12:34
Luis Alonso Ramos29-Mar-08 12:34 
GeneralRe: SQL query in c# Pin
Yevgeny Efter30-Mar-08 0:13
Yevgeny Efter30-Mar-08 0:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.