Reputation: 13636
I have TabControl that contain 4 subTabs.
Each of the tab contain picture box cotrol.
I need to get the picture box control of the selected Tab Control.
Any idea how to implement it?
Upvotes: 1
Views: 5982
Reputation: 47570
var pictureBox = tabControl1.SelectedTab.Controls.Cast<Control>()
.FirstOrDefault(x => x is PictureBox);
Upvotes: 1
Reputation: 836
You can find the control via
Once you find the control, you can then cast it to what you are expecting example:
[2] How to get control(s) from TabPage in C#?
Upvotes: 1
Reputation: 460288
Perhaps
var picBox = TabControl1.SelectedTab.Controls.OfType<PictureBox>().First();
Upvotes: 14