Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Implementing a Toolbar

I am using VB 3.0 professional edition. I would like to implement cut/copy/paste on a toolbar. My form has multiple text boxes. If the user wants to paste to a field, they click on the insertion point, then click on the paste button. How can I tell which field they were on? ActiveControl gets set to -1.

Do you actually have buttons in the toolbar, or are you using pictures? If you use buttons, the activecontrol will actually change. Pictures can't be set to the activecontrol, so the problem goes away. I think most of the 3rd party toolbars (I use Sheridan's) use pictures instead of buttons.

However, if you do want to implement a toolbar without a specialized control, you'll need to keep track of which control last had the focus. Once the user presses a button, use the last control that was used for cut/copy/paste.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date