Davide Andrea
Davide Andrea

Reputation: 1413

Given a TabPage, find its TabControl

I have an instance of a TabPage.

I want to ask that TabPage:

"Who's your TabControl?"

That is, I wish to query a TabPage to get a reference to the TabControl that contains it.

Upvotes: 1

Views: 1948

Answers (1)

Patrick Hofman
Patrick Hofman

Reputation: 156918

Try to cast the Tabpage.Parent to a TabControl:

TabControl parent = tabpage.Parent as TabControl;

Upvotes: 2

Related Questions