Forum » Programiranje » vb.net: zapri vse tabcontrole
vb.net: zapri vse tabcontrole
klemenSLO ::
V VB.netu bi rad napisal SUB, kateri skrije vse instance tabcontrol-ov na formi.
Poskušal sem takole pa ne gre :
pri vrstici for each tab javi:
Unable to cast object of type 'System.Windows.Forms.SplitContainer' to type 'System.Windows.Forms.TabControl'.
Poskušal sem takole pa ne gre :
Sub tab_zapre() Dim tab As System.Windows.Forms.TabControl For Each tab In Me.Controls tab.Visible = False Next tab End Sub
pri vrstici for each tab javi:
Unable to cast object of type 'System.Windows.Forms.SplitContainer' to type 'System.Windows.Forms.TabControl'.
Life is not measured in minutes, but in MOMENTS...
klemenSLO ::
Pa še tole:
Forma vsebuje splitcontainer. TAbi se poavljajo na splitcontainer.panel2
Forma vsebuje splitcontainer. TAbi se poavljajo na splitcontainer.panel2
Life is not measured in minutes, but in MOMENTS...
nightrage ::
Poiskus takole:
Sub tab_zapre() Control control = Nothing For Each control In Me.Controls if (control == typeof(System.Windows.Forms.TabControl)) then control.Visible = False Next tab End Sub
klemenSLO ::
Če zlistam vse obstoječe controle med njimi ni gumbov in taba.
vrne recimo splitcontainer,statusstrip...
Dejnsko so gumbi na splitcontainerju. Kako bi dostopal do tega? Splitcontainer ima haschildren = true
vrne recimo splitcontainer,statusstrip...
Dejnsko so gumbi na splitcontainerju. Kako bi dostopal do tega? Splitcontainer ima haschildren = true
Life is not measured in minutes, but in MOMENTS...
nightrage ::
Ja potem pol pa nared vgezdeno zanko al pa če greš rekurzivno čez vse kontrole, poiščeš TabControle in jim daš visible na false.
Sub tab_zapre() Control control = Nothing For Each control In Me.Controls if (control == typeof("splitcontainer")) then Control control1 = Nothing For Each control1 In control.Controls if (control == typeof(System.Windows.Forms.TabControl)) then control.Visible = False Next tab Next tab End Sub
klemenSLO ::
No pa sm sestavu. Ni optimalno vendar dela. So pa trije nivoji
(0)Forma:
(1)---SplitCOntainer
(2)-----splitpanel
(3)-------tabcontrol
(0)Forma:
(1)---SplitCOntainer
(2)-----splitpanel
(3)-------tabcontrol
For Each ctl As Control In Controls If ctl.HasChildren = True Then For Each chd As Control In ctl.Controls If TypeOf (chd) Is TabControl Then chd.visible = false If chd.HasChildren = True Then For Each chd2 As Control In chd.Controls If TypeOf (chd2) Is TabControl Then chd2.Visible = False End If Next End If End If Next chd End If Next ctl
Life is not measured in minutes, but in MOMENTS...
Zgodovina sprememb…
- spremenil: klemenSLO ()
Spura ::
Lahko preprosto napises rekurzivno funkcijo, ki ti preisce vse komponente poljubno globoko in ti vrne vse komponente dolocenega tipa.
Druga stvar:
If TypeOf (chd) Is TabControl Then
chd.visible = false
ti najbrz skrije tudi svoje otroke, ali pač?
Druga stvar:
If TypeOf (chd) Is TabControl Then
chd.visible = false
ti najbrz skrije tudi svoje otroke, ali pač?
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | [VB] polepšanje kodeOddelek: Programiranje | 746 (652) | korenje3 |
» | C# textbox polnjenjeOddelek: Programiranje | 1627 (1492) | Mitja Bonča |
» | vb.net: dynamic textboxOddelek: Programiranje | 1180 (1070) | saule |
» | C# ProgramOddelek: Programiranje | 3095 (2018) | Spura |
» | [VB express edition] problemOddelek: Programiranje | 1374 (1277) | frudi |