copy & paste

  • Thread starter Thread starter NuB
  • Start date Start date
N

NuB

I have a winform and a menu on the form, It allows the users to copy and
paste text from text boxes. I never had to do this before, how can I copy
and paste text from one box to another?
 
I'm not sure if I totally understand what you want to do. Do you want
to programmatically copy and paste? You can get access to the text of
the TextBox through the .Text attribute of the TextBox. That string can
then be copied and pasted. Is this what you are looking for? If not
please explain what your application is a little more.
 
it is if I right mouse click, I want to copy and paste from an Edit menu
from the tool bar on my form
James Curran said:
NuB said:
I have a winform and a menu on the form, It allows the users to copy and
paste text from text boxes. I never had to do this before, how can I copy
and paste text from one box to another?


Copy & paste should be enabled on each TextBox by default. You
shouldn't have to do anything.

--
Truth,
James Curran
[erstwhile VC++ MVP]

Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
 
So you want to create an edit menu on the tool bar of your form that
works like the standard "edit" menu on any windows form? If so, do you
need to know how to create that menu, how to actually cut and paste the
text from the textboxes or both?
 
You can access the text element of a TextBox with the .Text attribute.
So if you have

TextBox someTextBox = new TextBox();

in the event that gets fired when copy is clicked

private void copyWasClicked(object sender, EventArgs e)
{
string enteredText = someTextBox.Text;
}

Now you've copied from that TextBox, to paste just set the TextBoxes
..Text attribute to the string you want it to be? Let me know if this
helps.
 
Back
Top