I want to learn which tabpage in my window is active. My aim is something like this:
if Tabpage1 is active then
.....
end if
if Tabpage2 is active then
...
end if
I will write it on form closing.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You have to query the container control (the
TabControlcontrol) for this information, not the individualTabPagecontrols that it hosts.And you have two options for doing so, depending on the type of information that you wish to receive. You can either use the
SelectedIndexproperty, which returns the zero-based index of the currently selected tab page, or you can use theSelectedTabproperty, which returns an instance of theTabPageclass representing the currently selected tab page.Code sample:
Or: