how to set text alignment of dynamically added label where i am getting name of label in string variable one label is dynamically added in panel
Dim instance As New Label
Dim stringVariable As String
on form load event ::
instance.Location = New Point(15, 15)
instance.Size = New Size(60, 30)
instance.BorderStyle = BorderStyle.FixedSingle
instance.AutoSize = False
instance.Text = "LABEL1"
Me.Panel1.Controls.Add(instance)
i am getting name by:
for each c as control in Panel1.Controls
stringVariable=c.name
next
but its not possible to
Me.Panel1.Controls(stringVariable).textalign ??????
it does not show text align property
please help
DirectCast(Me.Panel1.Controls("Label1"), Label).TextAlign = ContentAlignment.TopRight