C# n00bie question

Started by
5 comments, last by SiCrane 12 years, 4 months ago
I've been going though Head First C#, making little button and text box based questions. It's simple. fun, and I seem to be learning a lot.

I then thought of a neat little Windows Form Program I want to make, just a whole bunch of a buttons of ASCII art names, and then when they click the button, the art appears. Super easy.

But I figured I should bump it up a notch, and I want to make it so when the MessageBox.Show appears, they can Copy the art that shows up and paste it into Skype, FB, or whatever.

The issue I have is that you cannot copy from a MessageBox. The user cannot highlight the text or anything.

Is there a way to do that? Or have the program throw the art on to their clipboard (this might be too difficult for me, idk)?



I'll hunt around the interwebz and try to find a solution, but any ideas or advice will be greatly appreciated!

Twitter

Learning to code in general, Junior at FAU

Advertisement

I've been going though Head First C#, making little button and text box based questions. It's simple. fun, and I seem to be learning a lot.

I then thought of a neat little Windows Form Program I want to make, just a whole bunch of a buttons of ASCII art names, and then when they click the button, the art appears. Super easy.

But I figured I should bump it up a notch, and I want to make it so when the MessageBox.Show appears, they can Copy the art that shows up and paste it into Skype, FB, or whatever.

The issue I have is that you cannot copy from a MessageBox. The user cannot highlight the text or anything.

Is there a way to do that? Or have the program throw the art on to their clipboard (this might be too difficult for me, idk)?



I'll hunt around the interwebz and try to find a solution, but any ideas or advice will be greatly appreciated!


Is there a way to do it? YES. Are you ready for it? Not a chance.

MessageBox is a system dialog that does not support Drag/Drop or Copy. So there is no easy way to do it. Now there are ways to do it with system calls using PInvoke. But you are not even close to being ready to go there.

theTRoll
Editing the style of the messagebox is more difficult.

Working with the clipboard is easy: http://msdn.microsoft.com/en-us/library/system.windows.forms.clipboard.aspx
I expect it will be easy enough for you to make a new form with a text box in it you can copy from instead of trying to do it with a message box.
In Vista and later, you can actually copy the contents of a standard messagebox by pressing ctrl+a (for select all) and ctrl+c (copy selection).

That said, copying a string directly to clipboard programmatically is very easy.

Niko Suni


I expect it will be easy enough for you to make a new form with a text box in it you can copy from instead of trying to do it with a message box.


Is there a property to make a TextBox un-editable?

Twitter

Learning to code in general, Junior at FAU

Yes, the ReadOnly property.

This topic is closed to new replies.

Advertisement