VB5 - Active X Control - Attribute as a keyword???

Hi,

I'm working my way through "Teach Yourself Database Programming with VB5 in 21 days" by SAMS Publishing.

Things being interesting because there are discrepancies between
what is printed on the page and what is supplied on the CD ROM.

So far I've managed to figure out what was wrong but this one has got me.

Day 12, building an Active X control to select from a list.

When I load up the CD rom version and compile it, it works.

When I load up the code I've typed in, it doesn't.

When I load up the ctl file into a text editor, I see that the CD
version has extra commands in the property definitions, like
Attribute DatabaseName.VB_ProcData.VB_Invoke_Property = "General;Data"

So, how is this command set, because when I type it in, VB5 doesn't
recognise it. How can I set it? I don't know if this is the cause of
why the typed in version doesn't work but it's a difference I've found.

Let me know if you need more details. TIA
alanlamAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mrmickCommented:
Click Project, References, and then check Microsoft DAO 3.5 Object Library, and add the missing code that you found on the CD-ROM.

0
alanlamAuthor Commented:
The Microsoft DAO 3.5 Object Library is already referenced.

The "attribute" bit of code from the program on the CD ROM doesn't appear when form is opened up using VB5.
It appears in the .ctl file when you open it up with notepad.

VB5 doesn't recognise the "attribute" keyword.
And, I can't find any mention of the attribute keyword in help files.
So somehow, those attributes are being set somewhere. Where?


0
mrmickCommented:
I see, search help on "Procedure Attributes Command"

Click Tools, Procedure Attributes.


0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

alanlamAuthor Commented:
Tools, Procedure Attributes looks promising but...
I'm a newbie to VB5 programming.

The .ctl code on the CD ROM (when opened with notepad) is :
Public Property Get DatabaseName() As String
Attribute DatabaseName.VB_ProcData.VB_Invoke_Property = "General;Data"
Attribute DatabaseName.VB_MemberFlags = "200"
    '
    DatabaseName = frmFind.Data1.DatabaseName
    '
End Property

Now, I can select property DatabaseName, but then I can't see anywhere to type in
DatabaseName.VB_ProcData.VB_Invoke_Property = "General;Data"

I'm sure we're getting somewhere, I just need more detailed instructions :-)

Supplementary side questions - what does this do, where can I find more info about it and why didn't the authors include it in the book? Is it very complicated or might have been set in a previous project when they renamed it?
0
anthonycCommented:
This is not a command you can type in.  Using the Procedure Attributes command, you have your properties/methods RESEMBLE the common properties.  Making the DatabaseName property resemble the data controls databasename property allows your control to be a databound control.  This is not something you set in code.  You set this using the Procedure Attributes Screen.  

One of the most common uses of this type of thing is with the enabled property.  You can make a property on yoru control called Enabled, and put all the proper code you would like, but it will not function like expected.  This is because the enabled property is handled by the container object (the form you put the control on) and is a special type of property.  By setting the Procedure Attribute of your Enabled property to ENABLED, you tell VB to treat this like a normal enabled property.  You provide the code, but VB handles the messaging properly!

Hope this helps!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
alanlamAuthor Commented:
Very close now. You didn't directly answer my question but the phrase that helped was "you tell VB to treat this like a normal enabled property"

After having yest another hard look at the differences between the two projects I noticed that under Advanced/Use this page in/Property - it was set to Data as opposed to (none) in my typed in version. Also
Advanced/Attributes/User Interface Default was ticked on the CD ROM version, but not on the one typed in. It didn't tell you to do any of this in the book Argggggghhhh.

Now DatabaseName properties under notepad has
Attribute DatabaseName.VB_ProcData.VB_Invoke_Property = ";Data"
Attribute DatabaseName.VB_MemberFlags = "200"

The first line is set by Advanced/Use this page in/Property/Data.
The second line is set by Advanced/Attributes/User Interface Default set to ticked.

Very, very close, but the typed in program still doesn't work.

So for the final part of my original question, how do I, from within VB5, get the first line to include "general" in it? Tell me step by step, even if it is obvious, because I think I'm going blind from looking at the same screens over and over again :-)

TIA
0
alanlamAuthor Commented:
Very close now. You didn't directly answer my question but the phrase that helped was "you tell VB to treat this like a normal enabled property"

After having yest another hard look at the differences between the two projects I noticed that under Advanced/Use this page in/Property - it was set to Data as opposed to (none) in my typed in version. Also
Advanced/Attributes/User Interface Default was ticked on the CD ROM version, but not on the one typed in. It didn't tell you to do any of this in the book Argggggghhhh.

Now DatabaseName properties under notepad has
Attribute DatabaseName.VB_ProcData.VB_Invoke_Property = ";Data"
Attribute DatabaseName.VB_MemberFlags = "200"

The first line is set by Advanced/Use this page in/Property/Data.
The second line is set by Advanced/Attributes/User Interface Default set to ticked.

Very, very close, but the typed in program still doesn't work.

So for the final part of my original question, how do I, from within VB5, get the first line to include "general" in it? Tell me step by step, even if it is obvious, because I think I'm going blind from looking at the same screens over and over again :-)

TIA
0
alanlamAuthor Commented:
Blast - forgot to hit reject answer. Could you answer the last comment please. Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.