I have two tabs in a tab control which basically have the same controls. Here's an example in which both tabs have in common:
GroupBox
On my click event of Button2 I want to access it's sibling (DataGridView) via the sender.
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Tab1_Button2.Click, Tab2_Button2.Click
Dim currSender As Button = sender
Do I need to go through the "currSender" parent? I'm not sure how to access those...
Try something like:
Dim dgv As DataGridView = currSender.Parent.Controls("DataGridView1")
Thats using the name of the control. You can get all the Datagridview
's on the GroupBox and take the (I suppose) first and only one:
Dim dgv As DataGridView = crrSender.Controls.OfType(Of DataGridView)(0)