Problems with DataGrid

G

Guest

Hi, I have two questions regarding DataGrid

Question 1

I have a DataGrid on my Form to collect data from users. When I'm typing text into the cells, if I press Shift + Spacebar, the current cell loses focus and the whole row is selected. I don't want that. How can I prevent that behavior ?

Question 2

How can I change the background color of a cell when it becomes the current cell and change it back to normal color when it loses focus ?

Thanks a lot.

Dotnetjunky
 
G

Guest

HI,

I have found the answer for question 2 :)

Now I only need the solution for question 1.

thanks.
 
C

ClayB [Syncfusion]

Try deriving the DataGrid and overriding ProcessDialogKey.

protected override bool ProcessDialogKey(Keys keyData)
{
bool bShift = (Control.ModifierKeys & Keys.Shift) != Keys.None;
if(bShift && (keyData & Keys.KeyCode) == Keys.Space)
{
return true;
}
return base.ProcessDialogKey (keyData);
}

=====================
Clay Burch, .NET MVP

Visit www.syncfusion.com for the coolest tools

Dotnetjunky said:
HI,

I have found the answer for question 2 :)

Now I only need the solution for question 1.

thanks.
text into the cells, if I press Shift + Spacebar, the current cell loses
focus and the whole row is selected. I don't want that. How can I prevent
that behavior ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top