المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Cut, Copy & Paste from variable text boxes



C# Programming
07-01-2009, 05:21 PM
Hi guys,

What I'm trying to do is cut copy and paste the selected text from any text box in my application. I have it working if it copies the entire text from the box, and I have it working if I hard code the text box name into to function.

Ive looked all over for an answer to this, and have got nowhere

This is the current code I am using:
string ActiveCon = this.ActiveControl.Name;
string SelText = ActiveCon.SelectedText;
Clipboard.SetText(SelText);
this.ActiveControl.Text = "";
It just does not like SelectedText used on a variable

Any help on this would be greatly appreciated.
Regards
Martin