Bonjour,
J'ai un petit programme, qui se sert dans plusieurs formes de dictionnaires statiques (dans le sens où ils ne sont jamais modifiés) sauf un (CollBool).
J'ai donc créé un module où j'ai mis :
ainsi qu'une public sub :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 Friend CollBool As New Dictionary(Of Integer, Boolean) Friend CollCB2 As New Dictionary(Of Integer, CheckBox) Friend CollTB1 As New Dictionary(Of Integer, TextBox) Friend CollTB2 As New Dictionary(Of Integer, TextBox) Friend CollTB3 As New Dictionary(Of Integer, TextBox) Friend CollR1 As New Dictionary(Of Integer, Label) Friend CollR2 As New Dictionary(Of Integer, Label) Friend CollOLabel As New Dictionary(Of Integer, Label) Friend CollRLabel As New Dictionary(Of Integer, Label)
qui va permettre de loader ce que je souhaite afficher en fonction des settings.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 Public Sub LoadingParameters() For i As Integer = 1 To CollBool.Count If CollBool.Item(i) = False Then CollTB1.Item(i).Hide() CollTB2.Item(i).Hide() CollTB3.Item(i).Hide() CollR1.Item(i).Hide() CollR2.Item(i).Hide() CollOLabel.Item(i).Hide() CollRLabel.Item(i).Hide() ElseIf CollBool.Item(i) = True Then CollTB1.Item(i).Show() CollTB2.Item(i).Show() CollTB3.Item(i).Show() CollR1.Item(i).Show() CollR2.Item(i).Show() CollOLabel.Item(i).Show() CollRLabel.Item(i).Show() End If Next
J'ai dans ApplicationEvents.vb ceci :
où tous mes dictionnaires sont remplis à l'ouverture du logiciel.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 Private Sub LoadApp(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles MyBase.Startup CollBool.Add(1, My.Settings.CBCobb1) CollBool.Add(2, My.Settings.CBRotation1) ... On remplit les dictionnaires puis Call LoadingParameters()
De ce que j'ai compris, ça devrait fonctionner ainsi : à l'ouverture du logiciel, tous mes dictionnaires (partagés entre toutes les forms) sont remplis. puis l'appli lance LoadingParameters, qui devraient afficher/cacher les textbox, etc concernées... Sauf que ça ne marche pas ainsi.
Où se situe mon erreur de raisonnement svp ? Je suis perplexe là -_-
Merci d'avance !
Partager