miplementing cut/copy/paste

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

VB2005

i need to implement cut/copy/paste as menu options
using th clipboard is ok, that works however how do i find the active
control and assuming it is a text box the portion of text selected?

I can not use Form.ActiveControl as that may be a user control which
contains the active TextBox

the ony way i can see is to iterate through the ActiveControl properties
chaining down until i find a control that makes sense eg textbox, but this
seems very long winded

this must be easy - i just cant see it!
 
guy,

This works in .NET, not I haven't used 2005 yet, but maybe this will
steer you in the right direction.

In the parent menuitem's select event, check what the ActiveControl's
type is then enable your menu selections accordingly.

Me.mnuEditCut.Enabled = TypeOf Me.ActiveControl Is TextBox
Me.mnuEditCopy.Enabled = TypeOf Me.ActiveControl Is TextBox
Me.mnuEditPaste.Enabled = TypeOf Me.ActiveControl Is TextBox

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top