Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3661264
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:17:12+00:00 2026-05-19T01:17:12+00:00

I need the LinkLabel control to not change Focus when it is clicked. I

  • 0

I need the LinkLabel control to not change Focus when it is clicked. I managed to use this.SetStyle(ControlStyles.Selectable, false) for a button, like so:

class NoSelectButton : Button
{
    public NoSelectButton()
    {
        // Button does not take focus when clicked
        this.SetStyle(ControlStyles.Selectable, false);
    }
}

But, doing this same thing with LinkLabels does not work.

class NoSelectLinkLabel : LinkLabel
{
    public NoSelectLinkLabel()
    {
        // Link Label still gets focus when clicked
        this.SetStyle(ControlStyles.Selectable, false);
    }
}

Does anyone have any insight into how I can get this to work the way I want it to? My impression from MSDN is that doing any manipulation to the focused control in the “GotFocus”, “LostFocus” and related events is a bad idea (from the “Caution” note here: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.lostfocus.aspx).

Here is a crude example that shows the behavior I’m seeing:

using System.Windows.Forms;

namespace LinkLabelTests
{
    public class Form1 : Form
    {
        NoSelectLinkLabel nsll;
        NoSelectButton nsb;
        TextBox tb;

        public Form1()
        {
            this.SuspendLayout();

            this.Width = 0;
            this.Height = 0;
            this.AutoSize = true;
            this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;

            nsll = new NoSelectLinkLabel();
            nsll.Text = "Link Label";
            nsll.Top = this.Bottom;
            this.Controls.Add(nsll);

            nsb = new NoSelectButton();
            nsb.Text = "Button";
            nsb.Top = nsll.Bottom;
            this.Controls.Add(nsb);

            tb = new TextBox();
            tb.Multiline = true;
            tb.Text = "Select this text, then click the button or link";
            tb.Width = 200;
            tb.Height = 100;
            tb.Top = nsb.Bottom;
            this.Controls.Add(tb);

            this.ResumeLayout();
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T01:17:12+00:00Added an answer on May 19, 2026 at 1:17 am

    Are you trying to maintain the selection in your TextBox when it loses the focus? If so, check out TextBoxBase.HideSelection. Setting it to false will allow you to achieve that.

    http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.hideselection.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need to store the tag from a clicked button: - (IBAction)buttonClicked:(id)sender { UIButton *button
I need to replace a word with another word. But $var= str_replace($linklabel[$k], $linklabelmod[$k], $var);
This is beyond both making sense and my control. That being said here is
need your advices on this scenario: I have a bunch of services installed on
Need to downgrade php to 5.2.x, so I followed this tutorial: http://andreys.info/blog/2010-03-25/compile-php-5-2-on-osx-10-6-snow-leopard#comment-631 I'm on
Need help reworking this php code/logic. Right now, if I have no value for
Need a function that takes a character as a parameter and returns true if
Need a way to allow sorting except for last item with in a list.
Need to an expression that returns only things with an I followed by either
Need to locate the following pattern: The letter I followed by a space then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.