Private currentLabel As Label
Private Sub labels_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles Label2.MouseDoubleClick, Label1.MouseDoubleClick
currentLabel = sender
Me.TextBox1.Text = currentLabel.Text
Me.TextBox1.Bounds = currentLabel.Bounds
Me.TextBox1.Visible = True
Me.TextBox1.BringToFront()
Me.TextBox1.Select()
End Sub
Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles TextBox1.KeyUp
If e.KeyCode = Keys.Enter Then
currentLabel.Text = Me.TextBox1.Text
Me.TextBox1.Visible = False
End If
End Sub
Why would you want to? Such a control already exists. It's called a TextBox. What you're asking for is like saying you want to get a car but you want to get one that goes on water. That's called a boat, so use a boat. What you want is a TextBox so use a TextBox.Thanks John for the reply. Can't we make a custom label control which we can edit.
The Height of a TextBox is controlled by its font so you cannot change it without changing the Font property.Sorry John, if my answer has annoyed you. My only concern is can we make size of textbox small with its border property set.