I'm new to C# (mostly do SQL development) and I'm having trouble getting my head around .net events and how to bring it all together. I have a form that looks roughly like this:
gridView1
gridView2 btn_Addpoint
gridView3 btn_RemovePoints
So on my form I have 3 Gridcontrols, the top one has the parent rows and the second one has the children. Then I have 2 buttons that can either add selected points from the 2nd grid to the 3rd grid and the remove button to remove them from the 3rd grid.
So when I add the button click event I have this:
btnAddPoint_Click(object sender, EventArgs e)
I understand the sender is the actual button and I have googled a bit and discovered the Tag property to create a pointer to one of the grids which you can Cast inside this button event to access the actual grid but it seems like it can only have 1 Tag so what about my other 2 grids?
The whole purpose is to check whether duplicates are added and I also need to change the colour of some of the rows based on conditions.
How do I "see" all 3 grids inside the 2 button events to get access to their rows? Should I make them global variables and somehow update them using events or setup a relationship somehow? I just need to be steered in the right direction here of what to do / what the best practise is, but some code would also be appreciated.