szabopeter2011 szabopeter2011 - 2 months ago 15
Vb.net 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

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