i've been searching on google and stackoverflow for 2hours now. There has to be something i am just simply overlooking. Is there an easy way to make the text selectable in a messagebox? As of right now when i call a MessageBox.Show() i can not copy the text displayed. Why not? how would i set the text to be copy able?
my code:
//catch all exceptions
catch (Exception ex)
{
MessageBox.Show(ex.Message);
//throw;
}
I want to be able to select the error message that comes out so a user can send it to me and i can troubleshoot their issue. Any help is greatly appreciated.
EDIT: Can not use the crtl-c method. My users are not able to grasp that concept. Need to highlight with mouse and right click to select option. THank you!
EDIT: For reference what i ended up doing is using a mixture of the answers. I created a popup window with a single button and upon the button action i copied to the clipboard. Its not perfect but with the right label it works well enough for now. Thank you all for the suggestions!
//catch all exceptions
catch (Exception ex)
{
//MessageBox.Show(ex.Message);
MessageBoxButtons buttons = MessageBoxButtons.OK;
DialogResult result;
// Displays the MessageBox.
result = MessageBox.Show(ex.Message + "\n\nClick OK button to copy to clipboard", "Error", buttons);
if (result == System.Windows.Forms.DialogResult.OK)
{
Clipboard.SetText(ex.Message);
//throw;
}
}
If a user presses Ctrl-C
while the MessageBox has focus, the message, the MessageBox caption and the MessageBoxButtons labels are copied to the clipboard.
Edit: You could output the messages to a text file and have them email it to you ? to make things easier, you could put the file on their desktop