Hi.................

How can i convert the Label to TextBox in VB.Net at runtime...

Recommended Answers

All 4 Replies

what do you want in converting?

Dim txt As New TextBox
            txt.Name = "txttest"
            Dim loc As System.Drawing.Point
            loc.X = 300
            loc.Y = 168
            txt.Location = loc
            txt.Text = "Testing textbox"
           
            txt.ReadOnly = False
            Me.Controls.Add(txt)

Get the location of your label control and set that location to textbox and after adding the textbox hide your lable control

what do you want in converting?

i need this conversion to rename a folder in list view at runtime. like our folder renaming(F2) option in windows

i need this conversion to rename a folder in list view at runtime. like our folder renaming(F2) option in windows

i do not know if that is possible...
if you just do it with a textbox to make it looks like a label...
here it is...

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        TextBox1.ReadOnly = True
        TextBox1.BorderStyle = BorderStyle.None
        TextBox1.BackColor = Color.White
    End Sub

then if you want to edit

Private Sub TextBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Click
        TextBox1.ReadOnly = False
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.