How to make a textbox non-selectable using C#

前端 未结 11 1858
轮回少年
轮回少年 2021-02-19 11:09

I\'m using C#/.NET for a Windows Forms application. I have a text box. How can I make the text box unselectable?

I don\'t want to disable the complete textbox.

11条回答
  •  后悔当初
    2021-02-19 12:08

    private void textBox1_Click(object sender, EventArgs e)
            {
                this.textBox1.SelectionStart = this.textBox1.Text.Length;
            }
    

    And don't forget that: read only=true

提交回复
热议问题