Click here to Skip to main content
14,383,100 members
Rate this:
Please Sign up or sign in to vote.
See more:

Can anyone know?

can we change the label size in VB.Net?if yes give me solution.....

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Dear Friend,

The following code example demonstrates the AutoSize property. To run this example, paste the following code in a form and call the InitializeLabel method from the form's constructor or Load method.

' Declare a label.
Friend WithEvents Label1 As System.Windows.Forms.Label

' Initialize the label.
Private Sub InitializeLabel()
    Me.Label1 = New Label
    Me.Label1.Location = New System.Drawing.Point(10, 10)
    Me.Label1.Name = "Label1"
    Me.Label1.TabIndex = 0

    ' Set the label to a small size, but set the AutoSize property
    ' to true. The label will adjust its length so all the text
    ' is visible, however if the label is wider than the form,
    ' the entire label will not be visible.
    Me.Label1.Size = New System.Drawing.Size(10, 10)
    Me.Label1.AutoSize = True
    Me.Label1.Text = "The text in this label is longer than the set size."

End Sub
sathiyak 20-Feb-12 1:28am
instead this we also give,autosize property as false we can change that label size....anyway thanks...
Varun Sareen 20-Feb-12 1:56am
yes :) its good you solved yourself

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100