J'ai un probleme avec textbox et label
nadeare
-
nadeare -
nadeare -
Bonjour,
Set label = Controls.Add("forms.label.1", "label" & d, Visible = True) ' creation automatique du label nommé nom de label
label.Top = 54 'label afficher à 50 pixel ds l a user form de hauteur
label.Left = 120 ' label à afficher 200 pixels à gauche
label.ForeColor = &H80000008
label.BackColor = &H80000005
label.Caption = TextBox1
je crée des llabel avec cette commende et suposon que j'ai 5 label de crée je voudrais que lorsque je click sur un label que le texboxt prenne la place du label pour modifier ca valeur.
Merci pour l'aide
Set label = Controls.Add("forms.label.1", "label" & d, Visible = True) ' creation automatique du label nommé nom de label
label.Top = 54 'label afficher à 50 pixel ds l a user form de hauteur
label.Left = 120 ' label à afficher 200 pixels à gauche
label.ForeColor = &H80000008
label.BackColor = &H80000005
label.Caption = TextBox1
je crée des llabel avec cette commende et suposon que j'ai 5 label de crée je voudrais que lorsque je click sur un label que le texboxt prenne la place du label pour modifier ca valeur.
Merci pour l'aide
A voir également:
- J'ai un probleme avec textbox et label
- Label printer logiciel - Télécharger - Outils professionnels
- Ronyasoft cd dvd label maker - Télécharger - Photo & Graphisme
- Barcode Label Printing Software TFORMER - Télécharger - Bureautique
- Cd label designer - Télécharger - Impression
- Label maker - Télécharger - Photo & Graphisme
3 réponses
Salut sadi9i !
Je vous propose de créer des Textbox au même endroit que tes labels et de les initialiser en visible=false.
Puis tu va dans evennement click de chaque label et tu met :
textbox.visible=true
label.text=textbox.text
C'est juste une idée !
Je vous propose de créer des Textbox au même endroit que tes labels et de les initialiser en visible=false.
Puis tu va dans evennement click de chaque label et tu met :
textbox.visible=true
label.text=textbox.text
C'est juste une idée !
merci pour c'ette idée mais je n'arrive pas a savoir le numéro du label car je les crées aux fur et a mesure alors comment allez dans lÉvennement click du label.
merci si tu peux m'aider.
merci si tu peux m'aider.
Pour connaitre le numéro du label:
tu fait :
for i=0 to Nb de controle_dans_ta_forme
if type du controle est label alors
controls.index(i) recoi tel chose
end if
tu fait :
for i=0 to Nb de controle_dans_ta_forme
if type du controle est label alors
controls.index(i) recoi tel chose
end if
Dim i As Integer ' Compteur destiné à individualiser les clés.
Dim a As Long
Dim reponse As Long
Dim nomlabel As Label
Dim b As Long
Private Sub label1_Click()
TextBox1.Text = Label1.Caption: Label1.Visible = False: TextBox1.Left = Label.Left
End Sub
Private Sub UserForm_Activate()
UserForm1.Height = Application.Height
UserForm1.Width = Application.Width
End Sub
Private Sub TextBox0_Change()
a = 1: b = 1: Cells(a, b) = UCase(TextBox0): TextBox1.Visible = False: TextBox1.Value = ""
If Len(TextBox0) = 4 Then
If TextBox1.Top <> TextBox0.Top Then TextBox1.Top = TextBox0.Top: TextBox1.Left = TextBox0.Left + 150
TextBox1.Visible = True
TextBox1_Change
End If
End Sub
Private Sub TextBox1_Change()
a = 1: b = 2: Cells(a, b) = UCase(TextBox1): Cells(a, b - 1) = TextBox0
If Len(TextBox1) = 4 Then lb Else
If Len(TextBox1) = 4 Then Selection.EntireRow.Insert: TextBox1 = "": TextBox1.Top = TextBox1.Top + 20
If TextBox1.Top = 540 Then TextBox1.Top = 140: TextBox1.Left = TextBox1.Left + 77
If Len(TextBox0) <> 4 Then Label.Visible = False
End Sub
Sub lb()
Set Label = Controls.Add("forms.label.1", "label" & a, Visible = True)
Label.Left = 157
Label.BackColor = &HFFFFFF: Label.ForeColor = &H80000007: Label.Caption = UCase(Cells(a, b)): Label.Top = TextBox1.Top
Label.Left = TextBox1.Left: Label.TextAlign = fmTextAlignCenter
'reponse = MsgBox
End Sub
Pour connaitre le numéro du label:
tu fait :
for i=0 to Nb de controle_dans_ta_forme
if type du controle est label alors
controls.index(i) recoi tel chose
end if
Merci de ta réponse mais je suis désolé je ne comprend pas ce que tu veux dire par la ,voie tu je suis un débutant dans la matière. Serait très apprécié si tu peux l'expliquer par une example merci
Dim a As Long
Dim reponse As Long
Dim nomlabel As Label
Dim b As Long
Private Sub label1_Click()
TextBox1.Text = Label1.Caption: Label1.Visible = False: TextBox1.Left = Label.Left
End Sub
Private Sub UserForm_Activate()
UserForm1.Height = Application.Height
UserForm1.Width = Application.Width
End Sub
Private Sub TextBox0_Change()
a = 1: b = 1: Cells(a, b) = UCase(TextBox0): TextBox1.Visible = False: TextBox1.Value = ""
If Len(TextBox0) = 4 Then
If TextBox1.Top <> TextBox0.Top Then TextBox1.Top = TextBox0.Top: TextBox1.Left = TextBox0.Left + 150
TextBox1.Visible = True
TextBox1_Change
End If
End Sub
Private Sub TextBox1_Change()
a = 1: b = 2: Cells(a, b) = UCase(TextBox1): Cells(a, b - 1) = TextBox0
If Len(TextBox1) = 4 Then lb Else
If Len(TextBox1) = 4 Then Selection.EntireRow.Insert: TextBox1 = "": TextBox1.Top = TextBox1.Top + 20
If TextBox1.Top = 540 Then TextBox1.Top = 140: TextBox1.Left = TextBox1.Left + 77
If Len(TextBox0) <> 4 Then Label.Visible = False
End Sub
Sub lb()
Set Label = Controls.Add("forms.label.1", "label" & a, Visible = True)
Label.Left = 157
Label.BackColor = &HFFFFFF: Label.ForeColor = &H80000007: Label.Caption = UCase(Cells(a, b)): Label.Top = TextBox1.Top
Label.Left = TextBox1.Left: Label.TextAlign = fmTextAlignCenter
'reponse = MsgBox
End Sub
Pour connaitre le numéro du label:
tu fait :
for i=0 to Nb de controle_dans_ta_forme
if type du controle est label alors
controls.index(i) recoi tel chose
end if
Merci de ta réponse mais je suis désolé je ne comprend pas ce que tu veux dire par la ,voie tu je suis un débutant dans la matière. Serait très apprécié si tu peux l'expliquer par une example merci