Bonjour,
J'ai besoin de votre aide. En effet, je crée un formulaire ou je fais apparaître des boutons sur chaque page d'un multipage que j'ai crée.
Je remplis également ces pages de Label(visible), Checkbox(visible) et de combobox (invisible)
J'aimerais que lorsque je click sur mes boutons cela rende visible les combobox situées en face des checkbox cochées
Private [/contents/446-fichier-sub Sub] CB1_Click() 'bouton "ajouter"
Dim i As Byte 'variable pages du multipage1
Dim j As Byte 'variable ajout des labels, checkbox et combobox sur chaque page
Dim k As Byte 'variable récupérant le nombre d'opé de l'équipe 1
Dim l As Byte 'Variable pour incrémenter la position "top" des labels
Dim Ajout_Label As Control
Dim Ajout_Textbox As Control
Dim Ajout_CommandButton As Control
Dim Ajout_Combobox As Control
'//Ajouter des pages comportant le nom du poste//
If Me.TB1.Text <> "" Then
Me.MultiPage1.Pages.Add
i = Me.MultiPage1.Count - 1
Me.MultiPage1.Pages.Item(i).Caption = TB1.Text
Me.TB1.Value = ""
Me.MultiPage1.Visible = True
Else
Erreur1 = MsgBox("Veuillez saisir le nom du poste à ajouter", vbExclamation, "Attention")
End If
'// Compléter chaque pages avec les contrôls visibles//
'Label1
Set Ajout_Label = Me.MultiPage1.Pages(i).Controls.Add("Forms.Label.1")
With Ajout_Label
.Left = 6
.Top = 7
.Width = 290
.Height = 12
.Caption = "Charge du poste (en heures) pour une équipe, sur un jour, à 1200 éléments :"
End With
'Textbox1
Set Ajout_Textbox = Me.MultiPage1.Pages(i).Controls.Add("Forms.Textbox.1")
With Ajout_Textbox
.Left = 290
.Top = 5
.Width = 30
.Height = 15
End With
'Label2
Set Ajout_Label = Me.MultiPage1.Pages(i).Controls.Add("Forms.Label.1")
With Ajout_Label
.Left = 10
.Top = 30
.Width = 200
.Height = 12
.Caption = "Cochez chaque opérateur formé à ce poste"
End With
'Remplir les pages du multipage1 en fonction de Paramètres2
For k = 1 To 21
If Paramètres2.Label22.Caption = k Then
l = 60
For j = 1 To k
'Label4 à Label24
Set Ajout_Label = Me.MultiPage1.Pages(i).Controls.Add("Forms.Label.1")
With Ajout_Label
.Left = 10
.Top = l
.Width = 150
.Height = 12
.Caption = Paramètres2.Controls("LB1" & j).Caption
End With
'Checkbox1 à Checkbox20
Set Ajout_checkbox = Me.MultiPage1.Pages(i).Controls.Add("Forms.checkbox.1")
With Ajout_checkbox
.Left = 150
.Top = l
.Width = 12
.Height = 12
End With
'Combobox1 à Combobox20
Set Ajout_Combobox = Me.MultiPage1.Pages(i).Controls.Add("Forms.Combobox.1")
With Ajout_Combobox
.Left = 170
.Top = l
.Width = 30
.Height = 15
.AddItem "1"
.AddItem "2"
.AddItem "3"
.Visible = False
End With
l = l + 20
Next
Exit For
End If
Next
'CommandButton de selection des niveaux
Set Ajout_CommandButton = Me.MultiPage1.Pages(i).Controls.Add("Forms.CommandButton.1")
With Ajout_CommandButton
.Left = 258
.Top = l + 20
.Width = 240
.Height = 18
.Caption = "Sélectionner les niveaux de formation"
End With
'// Faire apparaître les Combobox en fonction des checkbox//
End Sub