Dovberman
asked on
Copy textbox content to clipboard
The textbox content is already highlighted.
I would likethe user to click a button instead of using Ctrl_C to copy the content to the clipboard.
How can this be done?
void button1_click
// Code to copy textbox1.Text to the clipboard.
???
I would likethe user to click a button instead of using Ctrl_C to copy the content to the clipboard.
How can this be done?
void button1_click
// Code to copy textbox1.Text to the clipboard.
???
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi!
You cam aslo use
Windows.Forms.Clipboard.Se tText(...)
thanks!
You cam aslo use
Windows.Forms.Clipboard.Se
thanks!
ASKER
This is what worked. I skipped storing the stacktrace in a textbox, and copied it directly to the clipboard.
Form frmContactUs = new ContactUs();
frmContactUs.ShowDialog();
string strExDetail = ex.GetType() + "\n\n" + " " +
ex.Message + "\n\n" + " " +
ex.StackTrace;
Clipboard.SetText(strExDet ail);
Form frmContactUs = new ContactUs();
frmContactUs.ShowDialog();
string strExDetail = ex.GetType() + "\n\n" + " " +
ex.Message + "\n\n" + " " +
ex.StackTrace;
Clipboard.SetText(strExDet
ASKER
Thank you.
Additionally if you want to retain the selection even after copying (focus lost) to give better indication to user, then set the property "HideSelection" to "false" for that text box.
Rgds,
VinExpert