Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question on COPY and PASTE...
Message
From
03/09/2002 00:49:24
 
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00696093
Message ID:
00696108
Views:
23
Follow-up to this...

I found some code in the on-line help. Hopefully this is the way it's supposed to be done. Basically, the COPY is...

Form activeChild = this.ActiveMdiChild;
if (activeChild != null)
{
try
{
TextBox theBox = (TextBox)activeChild.ActiveControl;
if (theBox != null)
{
Clipboard.SetDataObject(theBox.SelectedText);
}
}
catch
{
MessageBox.Show("You need to select a TextBox.");


And then the PASTE does...

Form activeChild = this.ActiveMdiChild;
if (activeChild != null)
{
try
{
TextBox theBox = (TextBox)activeChild.ActiveControl;
if (theBox != null)
{
IDataObject data = Clipboard.GetDataObject();
if (data.GetDataPresent(DataFormats.Text))
{
theBox.SelectedText = data.GetData(DataFormats.Text).ToString();

Seems to work fine, thought I need to modify it to be able to copy/paste into rich textbox fields as well.
Previous
Reply
Map
View

Click here to load this message in the networking platform