Home All Groups Group Topic Archive Search About

UserControls Blessing and Curse

Author
20 Nov 2007 10:31 PM
Lorin
VB6SP6
Trying to work with UserControls
What are the secrets?
e.g.
  SHIFT F2  gives me "Can't jump to ... because it is hidden.

Huh? it is part of the project in the Project Group.
I am sure I will discover more.
A tutorial would be nice.

Other than having the ability (not used for some UserControls I have seen)
to have a visual interface, why use a UserControl and not a class?

Author
20 Nov 2007 10:44 PM
mayayana
> Other than having the ability (not used for some UserControls I have seen)
> to have a visual interface, why use a UserControl and not a class?
>

   I think that's it. A UserControl basically gives you
a blank window with an hWnd and the VB wrapper
properties (left, top, setfocus, etc.) That makes it
very easy to use at design time for owner-drawn
controls, makes it subclass-able, and make it a
usable base for positioning other controls if you
want to make a compound control.

(I don't have the slightest idea what SHIFT F2 is, though.)

  For more info. see here:
http://pntpm3.ulb.ac.be/Info/Activex/

It's Dan Aplpleman's ActiveX book online. There's
not much info. around about UserControls, but
the pages at that link at least describe many of
the unique qualities and events that you should
be aware of.
Author
21 Nov 2007 10:12 PM
Jeff Johnson
"mayayana" <mayaXXyan***@mindXXspring.com> wrote in message
news:ur$qgc8KIHA.6108@TK2MSFTNGP03.phx.gbl...

> (I don't have the slightest idea what SHIFT F2 is, though.)

Go To Definition
Author
21 Nov 2007 1:29 AM
Steve Gerrard
Show quote Hide quote
"Lorin" <Lo***@discussions.microsoft.com> wrote in message
news:43372BAD-3BAB-48E2-B4A4-B84312D017A1@microsoft.com...
> VB6SP6
> Trying to work with UserControls
> What are the secrets?
> e.g.
>  SHIFT F2  gives me "Can't jump to ... because it is hidden.
>
> Huh? it is part of the project in the Project Group.
> I am sure I will discover more.
> A tutorial would be nice.
>
> Other than having the ability (not used for some UserControls I have seen)
> to have a visual interface, why use a UserControl and not a class?
>

For your own user controls, don't make them a separate project, and don't
compile them to an OCX, there is no need. I use them all the time, and none of
them are OCXed. Just put them in your project along with forms and classes. The
only reason to make an OCX is if you want to distribute the control to other
developers.

Besides an actual visual interface, a user control can also receive messages
from the OS, producing events in the control. That's why a timer control, for
instance, despite not being visible, is a control, not just a class.

Other than that, the only benefit is that you can drop them onto a form to use
them. Most of mine (maybe all) have visual elements. I think they are a great
way to re-use parts of forms, and to combine relevant code with a set of
controls.