Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

How to display a link in textbox after text end?

I need to display a LabelLink after a TextBox value end. How can I do it?

TextBox box = new TextBox();
box.Font = new System.Drawing.Font("Times new Romance", 16);
LinkLabel lb3 = new LinkLabel();
lb3.Font = new System.Drawing.Font("Times New Romance", 16);
lb3.Text = "[Link1]";
box.Text= "User Name";
box.Location = new Point(50, 70);
box.Width = 250;
lb3.Dock = DockStyle.Right;// this is not the right way I need
lb3.Width = 77;
box.Controls.Add(lb3);

If I use the Right dock, the link will display at the right. But if the box's value is short the link will far from the text.

I need like

if the box.Text="Values" then the TextBox will display like

@Values [Link]   //only 1 space 

not like

@Values            [Link]   // too far from each other

In my case, I need the textbox to display the user name and the LinkLabel to click for checking user detail.

Comments