Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Datagridview Selectionchanged event not firing when I programmatically select a row

$
0
0

I have a datagridview in my c# winform and I want that whenever I come onto the page with the datagridview that the datagridview should be selected on the first row regardless of where it was before and I need the selection changed event to fire so that the code that needs to happen when I select a row can happen. The problem is the selection changed event doesn't fire over here.

This is my code can someone please help me understand what is going on over here?

  if (Main.uc1.dgvList.Rows.Count > 0)
            {
                Main.uc1.dgvList.CurrentCell = Main.uc1.dgvList.Rows[0].Cells[0];
                Main.uc1.dgvList.Rows[0].Selected = true;
            }


Debra has a question


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>