Disabling an unbound DataGridViewCell
-
I've searched around CodeProject and the boards but haven't found a solution to my problem. I have a DataGridView that is unbound. Based on selections in the first column from a ComboBox, other cells in that row may be set to ReadOnly. What I would like to do is skip over any ReadOnly cell when the user presses Tab (or Shift-Tab). I can get the selection to go where I want it to go, but the input focus still goes to the next cell even if it is ReadOnly. Example: The current cell is [0, 0]. Based on what I selected, the next cell ([1, 0]) is ReadOnly. I press Tab. What I want is for the selection and the input focus to move to cell [2, 0]. If I set the .CurrentCell to [2, 0] and then set .CurrentCell.Selected = true, I get the selection to highlight in the right spot, but the input focus still goes to cell [1, 0]. How do I completely skip over a specific cell? As an added bonus, it would be nice if when the user clicks on a ReadOnly cell, that the selection and input focus goes to the next cell instead of the ReadOnly cell. Can it be done? If so, how? I hope what I'm describing makes sense. Thanks.
-
I've searched around CodeProject and the boards but haven't found a solution to my problem. I have a DataGridView that is unbound. Based on selections in the first column from a ComboBox, other cells in that row may be set to ReadOnly. What I would like to do is skip over any ReadOnly cell when the user presses Tab (or Shift-Tab). I can get the selection to go where I want it to go, but the input focus still goes to the next cell even if it is ReadOnly. Example: The current cell is [0, 0]. Based on what I selected, the next cell ([1, 0]) is ReadOnly. I press Tab. What I want is for the selection and the input focus to move to cell [2, 0]. If I set the .CurrentCell to [2, 0] and then set .CurrentCell.Selected = true, I get the selection to highlight in the right spot, but the input focus still goes to cell [1, 0]. How do I completely skip over a specific cell? As an added bonus, it would be nice if when the user clicks on a ReadOnly cell, that the selection and input focus goes to the next cell instead of the ReadOnly cell. Can it be done? If so, how? I hope what I'm describing makes sense. Thanks.
listen, i don´t know if you can set a cell to readonly (or not) like you do in datagridview. Did you considered in setting values not in the DGV? i set dgv to readonly and get/set values in textboxes, comboboxes from dgv currentrow, i have 20 columns in dgv but only 14 textboxes or whatever, the ones i want to edit. ;P
nelsonpaixao@yahoo.com.br trying to help & get help