Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 1998-01-28
8
Medium Priority
?
300 Views
Last Modified: 2013-11-25
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
0
Comment
Question by:alanlam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
8 Comments
 
LVL 8

Expert Comment

by:mrmick
ID: 1453907
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
 

Author Comment

by:alanlam
ID: 1453908
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
 
LVL 8

Expert Comment

by:mrmick
ID: 1453909
I see, search help on "Procedure Attributes Command"

Click Tools, Procedure Attributes.


0
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 

Author Comment

by:alanlam
ID: 1453910
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
 
LVL 6

Accepted Solution

by:
anthonyc earned 200 total points
ID: 1453911
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
 

Author Comment

by:alanlam
ID: 1453912
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
 

Author Comment

by:alanlam
ID: 1453913
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
 

Author Comment

by:alanlam
ID: 1453914
Blast - forgot to hit reject answer. Could you answer the last comment please. Thanks
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Suggested Courses

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question