szabopeter2011 szabopeter2011 - 1 year ago 64 Question

How to get tab page's index by its name in VB.NET?

I'm trying to get a dynamically created tab page's index by its name with no luck. Any help would be appreciated!

Thank you in advance!

Answer Source

You can use linq to search the tabpages' properties and return the index:

Dim i As Integer = Enumerable.Range(0, TabControl1.TabPages.Count).Where(Function(x) TabControl1.TabPages(x).Name.Equals("TabPage1")).FirstOrDefault