Bonjour j'ai un petit problème
Actuellement je créée une série de label + une textbox associé sur un formulaire B pour chaque checkbox qui se trouve sur un formulaire A.
voici mon code:
Mais en fait je voudrais "affiner" le resultat car mon but n'est pas de créer toutes les textbox mais seulement celle dont la checkbox associée n'est pas cochée.
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
22
23
24
25
26 Sub Afficher_Justification_Checkbox_Non_Cochées() Dim i As Integer For Each cb As Control In Me.Controls Box_Justification = New TextBox If cb.GetType Is GetType(CheckBox) Then i = i + 1 Me.Box_Justification.Font = New System.Drawing.Font("Tahoma", 7.0!, System.Drawing.FontStyle.Regular) If lastbox Is Nothing Then Me.Box_Justification.Top = i * 70 Else Me.Box_Justification.Top = lastbox.Top + 40 End If Me.Box_Justification.Name = cb.Name Me.Box_Justification.Size = New System.Drawing.Size(157, 18) Me.Box_Justification.TabIndex = i Complément.Controls.Add(Box_Justification) lastbox = Box_Justification afficher_Button_Retour_Complément() afficher_Button_Suite_Complément() End If Next End Sub
Comment modifier ma procédure en ce sens?
Mais bien sur cela ne marche pas puisque cb correspond a un control et non pas a une checkbox...Je voulais faire qq chose du genre : if cb.checked = true then 'ma procédure









Répondre avec citation
Partager