Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question on COPY and PASTE...
Message
From
03/09/2002 00:51:09
 
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00696093
Message ID:
00696109
Views:
25
It's a little more involved than it was in VFP. There are methods on textboxes for doing this (MyTextBox.Cut(), MyTextBox.Copy(), etc.). In the Click Eventhandler on your Menu, you need to drill down through your Container controls to the ActiveControl and if it's a text box, then run the appropriate method. I.E.
// The click eventhandler for the Copy menu item:
public void ClickHandler(object sender, System.EventArgs e)
{
    if (Form.ActiveForm != null)
    {
        Control o = Form.ActiveForm
        while (o is ContainerControl)
        {
            ContainerControl oContainer = (ContainerControl)o;
            o = oContainer.ActiveControl;
        }
        if (o != null && o is TextBox)
            ((TextBox)o).Copy();
    }
}
Do this for each of your menu Click Eventhandlers.

HTH,
~~Bonnie



>In VFP apps, I was able to define a COPY and PASTE menu options, and hook them up with _med_copy and _med_paste commands.
>
>I haven't quite been able to figure out how to do this in WinForms. I created a menu pulldown called &Copy and &Paste, even tried to hook them up with Ctrl-C and Ctrl-V shortcuts, but I'm missing something.
>
>So how do you do this in Winforms?
>
>Thanks,
>Kevin
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform