Le problème c'est que "monlabel" n'a pas encore était crée en tant que
label c'est pourquoi je pense que "monlabel.Size.Width" ne me renvoi pas la valeur souhaité
Dim monlabel = New LinkLabel
Private Sub test() Dim x As Integer x = 100 For iter = 0 To 2 Dim malabel As New LinkLabel malabel.AutoSize = True malabel.Font = New Font("arial", 12, FontStyle.Bold) malabel.TextAlign = ContentAlignment.TopCenter malabel.Name = "ma" & iter.ToString malabel.Text = "www" & iter.ToString malabel.Location = New Point(x, 400) Me.Controls.Add(malabel) x += malabel.Width malabel.Visible = True AddHandler malabel.MouseDoubleClick, AddressOf malabelmouseclick Next End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question?localisation_original_x
x += malabel.Width
acteur = Split(Me.Text, " ") act_nom = acteur(0).ToString.ToUpper act_prenom = acteur(1).ToString.ToUpper
Private nomprenom() As String Do While (reader_nom.Read) And (reader_prenom.Read) ....... ...... frm_film.Controls.Add(monlabel) toute le reste et definir mouseclick event AddHandler malabel.MouseClick, AddressOf malabelmouseclick Loop Private Sub malabelmouseclick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) If TypeOf (sender) Is LinkLabel Then nomprenom = DirectCast(sender, LinkLabel).Text.Split(" ") End If End Sub
Private nomprenom() As String Do While (reader_nom.Read) And (reader_prenom.Read) ....... ...... frm_film.Controls.Add(monlabel) toute le reste 'et definir mouseclick event AddHandler malabel.MouseClick, AddressOf malabelmouseclick Loop Private Sub malabelmouseclick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) If TypeOf (sender) Is LinkLabel Then nomprenom = DirectCast(sender, LinkLabel).Text.Split(" ") End If End Sub