Private Sub Command3_Click() If Label1.Caption = "- Love is blind" Then Label1.Width = 8200 Else Label1.Width = 10 End If ' commente ou décommente la ligne suivante ... Label1.Caption = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionTu n'aurais pas laisser la propriété Autosize du label à True, par hasard ?
-- tu cliques bien sur un bouton nommé Command1
-- un label nommé Label1 est bien présent sur la même Form
Oui, mais alors ce n'est pas ce code lui-même, qui ne "marcherait pas" !
Il s'exécuterait de manière obéissante, en ce qui le concerne, mais toute nouvelle modification du Caption (après exécution de ce code et pas en raison de ce code) aurait le dernier mot.
'est ce que j'ai fais, mais lorsque je clique sur command 2 , label1 garde la taille 8200
Que vient maintenant faire ce click sur un bouton Command2 ?
If Label1.Caption = "- Love is blind" Then
Label1.Width = 8200
Else
Label1.Width = 4500
If Label1.Caption = "- Love is blind" Then Label1.Width = 8200 Else Label1.Width = 4500
Bouton Command2 deverait avoir un autre caption, mais je voudrais que sa taille soit 4500.
Le problème est que quand je passe à la deuxième bouton command , label1 garde le width 8200 alors que le code est:
Private Sub Command1_Click() Label1.Visible = True If Label1.Caption = "- Love is blind" Then Label1.Width = 8200 Else Label1.Width = 4500 End If End Sub Private Sub Command2_Click() Label1.Visible = True Label1.Caption = "- Love the heart that hurts you" End Sub Private Sub Command3_Click() Label1.Caption = "- Gather the rose of love whilst yet is time" End Sub