Forum Discussion
hi Colin_McCrae
I have found where all the tab names are present , kindly check the screenshot attached so , now what is the next thing I can do here as you mentioned earlier
In my case, I take the "Text" property (visible in your screenshot). Split it out into an array. Check the tab requested is valid by looking for a text match within the array. Then using the index number in the array (remember it when you find a match), I use that in the "SetActivePageIndex(<NUMBER>)" method of the TPageControl. This activates the requested tab for me.
I just tried "SetActivePage" and "UpdateActivePage" using the tab name (again, these are methods of the TPageControl) and nothing happened. Maybe that's down to how the devs here have set the controls up, I don't know. As I validate first, it doesn't matter.
However, if I use the ClickTab method of the TPageControl, using the tab caption as the parameter, so - ClickTab("<TAB_NAME>"), that works just fine too.
So it's up to you. Validate the tab name first, or just click it. But I suspect an invalid tab name will throw and error (or do nothing - one of the two). So it depends how much control you have over the tab selection names. Mine are user populated so validation first is a must. (It also makes for WAY more useful log messages ...)