Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is most lucid description of how to create a user control (VB6)?

19 views
Skip to first unread message

MM

unread,
May 7, 2013, 2:15:00 AM5/7/13
to
Book, web page etc?

MM

Deanna Earley

unread,
May 7, 2013, 6:34:13 AM5/7/13
to
On 07/05/2013 07:15, MM wrote:
> Book, web page etc?

Personally, I just go to the "Project" menu, then "Add User Control".

If you want any more specific advice, you're going to need to provide
FAR more information.

--
Deanna Earley (dee.e...@icode.co.uk)
iCatcher Development Team
http://www.icode.co.uk/icatcher/

iCode Systems

(Replies direct to my email address will be ignored. Please reply to the
group.)

MM

unread,
May 7, 2013, 7:32:00 AM5/7/13
to
On Tue, 07 May 2013 11:34:13 +0100, Deanna Earley
<dee.e...@icode.co.uk> wrote:

>On 07/05/2013 07:15, MM wrote:
>> Book, web page etc?
>
>Personally, I just go to the "Project" menu, then "Add User Control".
>
>If you want any more specific advice, you're going to need to provide
>FAR more information.

Not having written any user controls, I'd like to read a well-written,
detailed "how to" of the process. I've got Dan Appleman's book on
ActiveX, but it's far too wordy. I just need to know the nitty-gritty,
without an in-depth study of how the name ActiveX came about or Bill
Gates' inside leg measurement or such other arcane filler material
with which Appleman pads out his books.

I've also browsed the Amazon book section and checked "Look Inside"
when available. So far, I have a few books on my short list (all
available used for as little as a penny, plus �2.80 postage, i.e.
cheap as chips):

Programming Microsoft� Visual Basic� 6.0 - Francesco Balena
Visual Basic 6 How To Programm - Harvey M Deitel
Visual Basic 6 Programming Blue Book - Peter G Aitken

All the above have chapters on ActiveX programming.

I mostly have books up to VB5 in my cupboard. I've got several
VB6-specific books, but they're all to do with database design and
ADO.

So I'd like to know what other books programmers have used to get
started with writing a user control and which ones they found really
useful. There are so many new concepts to learn about, one of which
being "PropertyBag".

What I finally want to achieve is a control, in this case the Vemod
SeeThroughPictureBox (see http://www.musiker.nu/objectstudio/VBPage),
embedded in a user control that has extra properties added, so that I
don't have to store those extra values outwith the control as I have
done in the past. It's okay, until one has a control array and want to
add/remove new elements at runtime. Then managing the external
array/dictionary/collection/whatever becomes messy. Sure, one can use
the Tag property for some values, but storing several values of
different types in that one string property, although possible (I've
done it), again, it's messy.

Far better to just write the values into the extra properties designed
into the user control, so that if I remove an element from the control
array, that's it. I don't then have to faff around, removing related
data from external storage or setting some flag to -1 to denote
dead-ness.

Get my drift?

MM

Mayayana

unread,
May 7, 2013, 8:30:15 AM5/7/13
to
I have some samples here:

http://www.jsware.net/jsware/vbcode.php5

The "Glow button" might be good. It's a very simple
control but uses Paul Caton's code to self-subclass
and also uses PropertyBag to provide some custom
properties.

The only source I can remember being useful was
Matthew Curland's book, though I'm not sure if he
actually dealt with UCs for their own sake. He did a
lot with them for owner-drawn and API-produced
controls.

Dan Appleman's book provides the best information
I know of, especially in terms of events. UC events
are tricky and poorly designed.

The purpose you want the UC for is the basic version
that original VB books advertised, which is probably
why so few people use UCs. Mounting one or more
existing controls onto a window in order to "customize"
them is limited and unappealing in most cases. ("Look!
You can put an image in a Picturebox and have your
very own Logo Control!")
A UC is basically a blank window. The real value of it
is for creating new controls and self-subclassing. But
you certainly can do what you want. All you'll realy need
to know about is PropertyBag.

There is one strange bug in the VB IDE to know about:
When you want to use a UC in a project you add the UC
project and the UC will show up in the "toolbox". It will act
pretty much like a normal control. But anytime you open
the gui/form view of the UC you have to specifically close
that sub-window or VB may get confused. (I've forgotten
the exact problem. I think maybe it refuses to compile.
Just keep it in mind -- if you run into an unexplainable error,
an unclosed UC form view may be the cause.)


MM

unread,
May 7, 2013, 9:43:23 AM5/7/13
to
On Tue, 7 May 2013 08:30:15 -0400, "Mayayana"
<maya...@invalid.nospam> wrote:

>I have some samples here:
>
>http://www.jsware.net/jsware/vbcode.php5
>
> The "Glow button" might be good. It's a very simple
>control but uses Paul Caton's code to self-subclass
>and also uses PropertyBag to provide some custom
>properties.
>
> The only source I can remember being useful was
>Matthew Curland's book, though I'm not sure if he
>actually dealt with UCs for their own sake. He did a
>lot with them for owner-drawn and API-produced
>controls.

Did you mean Advanced Visual Basic 6: Hardcore Programming Techniques?
Amazon have a used copy for �4.99.

Thanks for the other info, by the way.

Question: I assume that the only way to "talk" to the properties of
the control being embedding in the user control is by using Let and
Get to mimic them. For example, the SeeThroughPictureBox has a
Transparent property. To set or retrieve this value (True/False) in
the user control I'd need to provide the user control with a Property
Let Transparent and a Property Get Transparent procedure, yes?

MM

Mayayana

unread,
May 7, 2013, 9:55:19 AM5/7/13
to
| Did you mean Advanced Visual Basic 6: Hardcore Programming Techniques?
| Amazon have a used copy for �4.99.
|

Yes. I found it useful when first making API-created
controls, but I can't remember how much detail he
provided. I think I depended on his code samples to
get the startup and close right. That's the poorly
designed event structure I was talking about.) But
I think Dan A. was the only one who really explained
the details.

| Question: I assume that the only way to "talk" to the properties of
| the control being embedding in the user control is by using Let and
| Get to mimic them. For example, the SeeThroughPictureBox has a
| Transparent property. To set or retrieve this value (True/False) in
| the user control I'd need to provide the user control with a Property
| Let Transparent and a Property Get Transparent procedure, yes?
|

Get/Let provide runtime access. PropertyBag provides
design-time listings in the Properties window. You can
see a simple example of both in the Glow button sample.


Deanna Earley

unread,
May 7, 2013, 10:53:42 AM5/7/13
to
On 07/05/2013 14:43, MM wrote:
> Question: I assume that the only way to "talk" to the properties of
> the control being embedding in the user control is by using Let and
> Get to mimic them. For example, the SeeThroughPictureBox has a
> Transparent property. To set or retrieve this value (True/False) in
> the user control I'd need to provide the user control with a Property
> Let Transparent and a Property Get Transparent procedure, yes?

Correct.
Note that while the constituant "SeeThroughPictureBox" may be
transparent, all it will do is allow the user to see through to your
user control.
You will then need to do all the work to make your control see through
too (largely reimplementing the SeeThroughPictureBox?).

MM

unread,
May 7, 2013, 12:51:52 PM5/7/13
to
On Tue, 07 May 2013 15:53:42 +0100, Deanna Earley
<dee.e...@icode.co.uk> wrote:

>On 07/05/2013 14:43, MM wrote:
>> Question: I assume that the only way to "talk" to the properties of
>> the control being embedding in the user control is by using Let and
>> Get to mimic them. For example, the SeeThroughPictureBox has a
>> Transparent property. To set or retrieve this value (True/False) in
>> the user control I'd need to provide the user control with a Property
>> Let Transparent and a Property Get Transparent procedure, yes?
>
>Correct.
>Note that while the constituant "SeeThroughPictureBox" may be
>transparent, all it will do is allow the user to see through to your
>user control.
>You will then need to do all the work to make your control see through
>too (largely reimplementing the SeeThroughPictureBox?).

Ah. So I haven't gained anything, then? If the user control isn't
naturally transparent, I'm wasting my time.

MM

ralph

unread,
May 7, 2013, 2:11:05 PM5/7/13
to
On Tue, 07 May 2013 07:15:00 +0100, MM <kyli...@yahoo.co.uk> wrote:

>Book, web page etc?
>
>MM

The most concise and complete explanation can be found in O'Reilly's
"MCSD In A Nutshell: The Visual Basic Exams". Don't let the title or
its avowed purpose fool you - it is amazingly readable.

-ralph

CoderX

unread,
May 7, 2013, 10:58:21 PM5/7/13
to



"MM" <kyli...@yahoo.co.uk> wrote in message
news:mboho8d76c9cdla59...@4ax.com...
> Not having written any user controls, I'd like to read a well-written,
> detailed "how to" of the process. I've got Dan Appleman's book on
> ActiveX, but it's far too wordy. I just need to know the nitty-gritty,
> without an in-depth study of how the name ActiveX came about or Bill
> Gates' inside leg measurement or such other arcane filler material
> with which Appleman pads out his books.

Erm...that book *is* the nitty gritty. What would be the point of using COM
if you don't understand it?


CoderX

unread,
May 7, 2013, 11:00:03 PM5/7/13
to

"Mayayana" <maya...@invalid.nospam> wrote in message
news:kmartu$61f$1...@dont-email.me...
>I have some samples here:
>
> http://www.jsware.net/jsware/vbcode.php5
>
> The "Glow button" might be good. It's a very simple
> control but uses Paul Caton's code to self-subclass
> and also uses PropertyBag to provide some custom
> properties.
>
> The only source I can remember being useful was
> Matthew Curland's book, though I'm not sure if he
> actually dealt with UCs for their own sake. He did a
> lot with them for owner-drawn and API-produced
> controls.

He wants 'nitty gritty' and you're giving him Curland and Caton? I guess if
one wants to understand the solar system, quantum mechanics would be a good
place to start. <g>


MM

unread,
May 8, 2013, 1:54:09 AM5/8/13
to
On Tue, 07 May 2013 13:11:05 -0500, ralph <nt_con...@yahoo.com>
wrote:
Well, on the basis of your recommendation, Ralph, and what other
Amazon reviews have said, I've just ordered a used copy for one penny
from Amazon UK! The postage is only £2.80, but I've bought several
used books this way before and it's a darned fine and cheap way of
acquiring what are usually very expensive books. I'm bound to get
something from a book costing me a grand total of £2.81!

So, many thanks!

MM

MM

unread,
May 8, 2013, 2:06:41 AM5/8/13
to
But Appleman's writing style is too wordy for my liking. I was a
technical translator once and had to get used to the fact that a
German rendition is usually longer than the English original. But it
all had to fit on the same page, because the same print run was used
for all languages and the pictures, line drawings etc were all in the
same place. Sometimes it took me ages to pare down the wording to be
as concise as possible.

Ole Dan, on the other hand, seems to like using as many words as
possible! As an exercise earlier this morning (yeah, I wake up early!)
I took the opening sentences of his Chapter One from the VB5 edition
of his ActiveX book and played around with them. Without even trying I
was able to save a dozen words straight off, thus improving
readability and comprehension. Imagine how much shorter the book would
be if this were done throughout!

However, see Ralph's book recommendation below and my response.

Cheers!

MM
0 new messages