Hi,
This might be trivial, but for some reason I can't fake the "Control C" keydown of a user. I am merely trying to make a function to do use the built in Copy function of ultragrid, so I thought by calling
KeyDown(
this, new KeyEventArgs(Keys.LButton | Keys.ShiftKey)); -- control key
then followed by
this, new KeyEventArgs(Keys.C)); would be the easiest solution...
I just want to use the built in Copy function, please advise
Hello,
May be you are looking for the following property of the UltraGrid that will allow you to use Control+C to copy data from it:
ultraGrid1.DisplayLayout.Override.AllowMultiCellOperations = Infragistics.Win.UltraWinGrid.AllowMultiCellOperation.Copy;
Sincerely,
Danko Valkov
Developer Support Engineer
Infragistics, Inc.
Not really, I am trying to duplicate that "Control + C" pressing as a tool. Like a button that a user would like to click to Copy.
I have tried all the below code to trap a Ctrl+C on event keydown of ultrawingrid, but unfortunately it did not work.
Can you tell me what could be the reason?
If
(e.KeyCode = Keys.C And e.Modifiers = Keys.Control) Then
MessageBox.Show("Ctrl-c Pressed")
End If
If e.Control And e.KeyCode = Keys.C Then
If e.Control Then
If e.KeyCode = Keys.C Then
What exactly "did not work" about it?
sorry for the level of detail given.
When i use the above code, I expect to get at least one alert message showing a message "Ctrl-C Pressed". But I am not getting any alert.
When I try to debug by pressing "Ctrl + C" on the keyboard then the keydown event written for Ultrawingrid triggered only once for the key Ctrl and not for the key C.
Can you please give me the code to capture "Ctrl+C" ?
There's no trick to it, the grid is just like any other control. If the grid events are not firing when you press Ctrl+C, then there are two possibilities:
1) The grid is not the active control (this seems unlikely since you are getting a KeyDown for the Ctrl key).
2) Something else is catching and eating the key.
My guess is that you have a toolbar or a context menu on the form which is using Ctrl+C as a shortcut and so you won't get key messages for this combination for any control on the form.
Hi Guys,
I am trapped in similar problem. How do I catch/hit Ctrl + C.
If e.Key = Key.C Then If e.KeyboardDevice.Modifiers = Windows.Input.ModifierKeys.Control Then MessageBox.Show("Pressed Ctrl + C") End If End If
Here when I keep pressed Ctrl button, then only condition is getting satisfied. If rapidly click Ctrl + C, here by the time I press key "C" modifier key Control is shifted up.
Please provide me with some inputs over this.
Hi Nitin,
I don't understand what you are asking. Nothing about GetData will consume any keystrokes. It sounds to me like maybe you are trying to use breakpoints to Debug this, but you really can't do that because the event will fire when you press Ctrl, but before you press "C". So if you have a breakpoint in the event, you will never see the "Ctrl+C" case.
I think I have found the problem, this line of code is consuming "Modifier" key,
Clipboard.GetDataObject().GetData(DataFormats.Text)
I am using above condition to enable copy context menu.
How can I overcome this problem, is there any alternative way?