|
-
Oct 19th, 2009, 08:05 PM
#1
Get the currently selected textbox?
Basically, I have an MdiParentForm with a big amount of MdiChildForms, and I need to get the active Textbox in the Active MdiChildForm to perform copy/cut/paste/clear functions on from a dropdown menu on the MdiParentForm.
How can I do this?
-
Oct 19th, 2009, 08:13 PM
#2
Re: Get the currently selected textbox?
The short answer is Me.ActiveMdiChild.ActiveControl.
That said, you really should first check that there is an active child and you'll then have to cast the active control as type TextBox.
That said, I don't think it should be done that way. While Friend is the default, I strongly believe that all controls should be declared Private. Presumably you have a menu/tool bar in the parent form that has cut/copy/paste option on it. The most professional way to implement this would be to have each child form expose a property that indicates whether cut/copy and paste operations are possible and an event to indicate when that property value changes. The parent can then handle those events and query those properties to determine whether to enable those menu/tool bar items. Similarly, actually performing the actions should be done by the child forms after the parent form calls a method created for the purpose.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|