I've got a grid with column of checkboxes not bound to anything. When a range of checkboxes needs to be clicked, instead of having to click them one by one, I'd like to provide Windows like behavior with a Shift-Click like ability. Like use of Up,Down,Ctrl,Home,End would be nice too but just Shift-Click would be better than nothing. I haven't found some inherent setting to make any of this happen.
I haven't even been able to check whether or not Shift or ShiftKey is pressed from CellChange yet whereas it'd be easy from KeyDown or KeyUp which aren't used here.
Hi,
I'm a little fuzzy on exactly what you want to do here. How do you determine the range of checkboxes that need to be checked or unchecked? So you mean you want ALL of them checked?
You would have to use KeyUp or KeyDown to trap for the shift key. CellChange can't provide any key information, because the cell change could occur from something that has nothing to do with the keyboard. You could, for example, click a context menu with the mouse to paste into a cell.
I know there static method in DotNet to determine the current state of the MouseButtons at any given time. So I wonder if there might be similar methods for the key states. If so, I don't know what they are, but it might be worth looking into. Perhaps a Microsoft forum or a general DotNet programming forum might be a good place to post the question. Or you could try searching MSDN or the web. :)
Thanks for the reply.
So I've got a column of unchecked checkboxes in a grid of data. Let's say the user wanted to check the 6th through the 23rd boxes. What's the best way to provide a Windows like ability to click the 6th box, then hold down a Shift key, and click the 23rd box, checking all boxes in that range?
I'll give key state methods research. I've definitely searched the web but might post to MSDN like you said.
Okay, I'll try that. Thank you.
How do I set the cell value of the checkbox? Would it be something like "cell.Value = ?"
Yes.
row.Cells["MyCheckBoxCell"].Vaule = true;
I have a problem with this. I try to get the value of the checkbox in the UltraGrid and I have an error message say Key Not Found. Please help
Look at the "Key" property of your column that contains the checkbox. So, in other words, if your column's key property is "send email", then your code should look like this:
row.cells("send email").value = true
I have the column name from the dataset. I check it for many time for typo, and even cut and paste the column name, so I assume it's not a typo. Don't know why?
Thanks
Waisted time to debug, but not find an answer. Finally I restarted the computer and it work. Don't know why?