Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Disabling an unbound DataGridViewCell

Disabling an unbound DataGridViewCell

Scheduled Pinned Locked Moved C#
questionhelptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    David Fleming
    wrote on last edited by
    #1

    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.

    N 1 Reply Last reply
    0
    • D David Fleming

      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.

      N Offline
      N Offline
      nelsonpaixao
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups