Detecting some text has been selected in a textbox

Total Post:2

Points:14

C# 
C#
 1592  View(s)
Ratings:
Rate this:

Hi MindStickians!

I'm new in C#. I want to get value from clipboard (copy values) and selected string from textbox if textbox string are selected.

Please help me!

Thanks in advance.

  1. Re: Detecting some text has been selected in a textbox

    Hi Dematagoda!


    Used below line of code

    private void button1_Click(object sender, EventArgs e) 
     { 
     if (textBox1.SelectionLength > 0) 
     { 
     string clipString = System.Windows.Forms.Clipboard.GetText(); 
     string SelString = textBox1.SelectedText; 
     } 
     }

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.