Checking how many tabs are open

Leszek1

Новичок
Регистрация
11.11.2017
Сообщения
23
Благодарностей
4
Баллы
3
Hello, you can have an idea how to check how many tabs are open in the project, and if there are more than one, delete all and leave only the first one. ??? , I thought, I was combining and I have no idea - probably only in c #?
 

LaGir

Client
Регистрация
01.10.2015
Сообщения
212
Благодарностей
861
Баллы
93
how to check how many tabs are open in the project, and if there are more than one, delete all and leave only the first one. ??? , I thought, I was combining and I have no idea - probably only in c #?
Yes, C#...
C#:
//If tabs are more than one
if (instance.AllTabs.Length>1){
    //Delete all and leave only the first one
    for (int i=1; i<instance.AllTabs.Length; i++){
        instance.AllTabs[i].Close();
        i--;
    }
}
 
  • Спасибо
Реакции: Leszek1

Dimionix

Moderator
Регистрация
09.04.2011
Сообщения
3 068
Благодарностей
3 106
Баллы
113
C#:
Tab[] tabs = instance.AllTabs;
for (int i = 1; i < tabs.Count(); i++)
    tabs[i].Close();
 
  • Спасибо
Реакции: Leszek1

Leszek1

Новичок
Регистрация
11.11.2017
Сообщения
23
Благодарностей
4
Баллы
3
Super, thanks great, you can always count on help from your side :-), thanks
 
  • Спасибо
Реакции: LaGir и Dimionix

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)