Slt tout le monde, je vous expose mon problème:
je crée une frame dans laquelle vont venir s'ajouter une suite de contrôles dynamiques. Le souci, c'est qu'en haut de la frame des contrôles intempestifs vont venir se rajouter en parallèle et moi je veux les virer.
Voici le morceau de code qui fait ces actions:
Code :
Private Sub Visualiser_Click()
infos.Visible = True 'ma frame visible
'Remplissage des données concernant les taches de l'affaires
k = 1
b = n_line2 - 1
b = b + 1
While LCase(ThisProject.Tasks(b).Name) <> "a"
Set taches5 = infos.Controls.add("Forms.textbox.1", "taches" & b, True)
Set achieve3 = infos.Controls.add("Forms.Textbox.1", "achieve3" & b, True)
Set ch3 = infos.Controls.add("Forms.Textbox.1", "ch3" & b, True)
Set d3 = infos.Controls.add("Forms.Textbox.1", "d3" & b, True)
Set f3 = infos.Controls.add("Forms.Textbox.1", "f3" & b, True)
With taches5
.AutoSize = True
.Left = 18
.Top = 3 + 24 * k
.Width = 60
.Height = 16
.Value = ThisProject.Tasks(b).Name
.Locked = True
.BackStyle = fmBackStyleOpaque
.BorderStyle = fmBorderStyleSingle
End With
With achieve3
.AutoSize = True
.Left = 280
.Top = 3 + 24 * k
.Width = 60
.Height = 16
.Value = ThisProject.Tasks(b).PercentComplete & " " & "%"
.BackStyle = fmBackStyleTransparent
.BorderStyle = fmBorderStyleSingle
.Locked = True
End With
With ch3
.AutoSize = True
.Left = 330
.Top = 3 + 24 * k
.Width = 60
.Height = 16
.Value = FormatNumber((ThisProject.Tasks(b).Work / 60), 2) & " " & "hrs"
.BackStyle = fmBackStyleTransparent
.BorderStyle = fmBorderStyleSingle
.Locked = True
End With
With d3
.AutoSize = True
.Left = 410
.Top = 3 + 24 * k
.Width = 60
.Height = 16
.Value = Format$(ThisProject.Tasks(b).Start, "dd/mm/yy")
.Locked = True
End With
With f3
.AutoSize = True
.Left = 480
.Top = 3 + 24 * k
.Width = 60
.Height = 16
.Value = Format$(ThisProject.Tasks(b).Finish, "dd/mm/yy")
.Locked = True
End With
k = k + 1
b = b + 1
wend
end sub
Merci d'avance pour votre aide précieuse