I have a project with a form with 3 tabs, each contains 1 datagridview. I disabled multiselect and can only select a row.
I need to Add new data rows or Modify rows of datas from these three datagrids, so I have a MenuStrip on top of the window with a menu with a “Add”, “Modify” and “Delete Selected Row” options.
How do I know which row is currently being selected in the current selected tab containing the datagrid which contains that row? Because there are 3 tabs containing 3 datagrids. I don’t want to get the output saying there are 3 datagridviews selected with whatever row was selecting. I want the one row on my screen.
Please ask me if my question isn’t clear enough.
I’m assuming that this question is about
WinForms. Below there’s a schematic code logic sample for clicking aToolStripMenuItemnamedShow selected rowbelonging to aMenuStripon the form. Just adapt the method logic to yourModifyandDeletebuttonsclickevents.For the .NET Framework 2.0, you can find the selected tab’s first
DataGridViewcontrol, if existing, like this: