Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Setting default property of custom collection class

02 Aug 2011   #1
Ken9251

Windows 7 Home Premium 64-bit
 
 
Setting default property of custom collection class

In VBA, I am trying to set the Item property of a custom collection class, clsStudents, to be the default property. The recommended way of doing this seems to be as follows:
1. Remove and export the class module
2. Change it to a txt file.
3. Add the following line to the Item property using Notepad:
'Attribute Item.VB_UserMemId = 0' giving:

Public Property Get Item(strKey As String) As clsStudent
Attribute Item,VB_UserMemId = 0
Set Item = mcol(strKey)
End Property

4. Import the txt file back into the project.

The trouble is the addition is highlighted as a syntax error!

Ken


My System SpecsSystem Spec
.
04 Aug 2011   #2
Lomai

Win7 HP (x64)/Win7 Ultimate (x64)
 
 

Quote   Quote: Originally Posted by Ken9251 View Post
In VBA, I am trying to set the Item property of a custom collection class, clsStudents, to be the default property. The recommended way of doing this seems to be as follows:
1. Remove and export the class module
2. Change it to a txt file.
3. Add the following line to the Item property using Notepad:
'Attribute Item.VB_UserMemId = 0' giving:

Public Property Get Item(strKey As String) As clsStudent
Attribute Item,VB_UserMemId = 0
Set Item = mcol(strKey)
End Property

4. Import the txt file back into the project.

The trouble is the addition is highlighted as a syntax error!

Ken

Hi

Would the .(dot)and ,(comma) have anything to do with it?

Regards
My System SpecsSystem Spec
04 Aug 2011   #3
Ken9251

Windows 7 Home Premium 64-bit
 
 

Thanks Lomai

No, I transcribed it incorrectly, but it was a dot in the code. I have, however, found the answer. I had added a comment against the Attribute line and by removing this it has worked OK. I hadn't realised that the line does not display in the editor so it was pointless anyway.

I suppose the moral is to cut and paste from the code to the message. If I had done so the dot would have shown correctly and the added comment would have been displayed to enable the fault to be diagnosed.

Thaks again
My System SpecsSystem Spec
.

Reply

 Setting default property of custom collection class




Thread Tools




Similar help and support threads
Thread Forum
Custom Start Menu Button Collection
This is a compilation of Start Orbs for Download. Posters should post a preview and upload the file as attachment or other. By posting an image here you give consent for the image to be used,this saves asking if they can use it.Keep info if any minimal,this should not be a disscussion or request...
Themes and Styles
IE Security Setting Changes to Custom & CPU Usage very high
The security setting on Internet Explorer keeps changing to Custom. I keep changing it back to the default level of Medium-High but some how it reverts back to Custom. I went to the Microsoft website and found a fix that didn't work. The cpu usage is also extremely high 80% - 90% even when there...
Browsers & Mail
Setting Custom Screen Resolution?
I've been using my TV to play games on my desktop over HDMI for years, and I've always had a screen resolution that fit the TV display perfectly (1768x992). Recently, I purchased a new laptop for myself and have started using it more to game on, and I've been trying to hook it up to my TV over...
Graphic Cards
Setting Custom Shutdown Message
Hi, I'm new to windows development work. :cool: and I've Windows 7 installed. Now, I want to set a custom shutdown message - a custom message that I want to appear for sometime after I click the Shutdown button. Actually, my prob is that I've a portable mouse and keyboard. I always forget to turn...
General Discussion
Setting Custom Icons for Themes
How do you do that in Windows 7? (I use Home Premium) I know it was quite easy in Windows XP, but I can't figure out how to do it anymore. What I need help with: Setting custom icons for certain file types. IE: The default Folder icon to something different. Or, setting a different icon...
Themes and Styles
Windows 7-Bug with setting custom sounds and themes
Ok so I decided to try 7 and got it working fine. Started porting my sound theme settings which work perfectly under Vista x64. However, for some reason, after setting the custom sounds into Windows 7 and saving it as a theme, some of them refuse to play. COMPLETELY. To make matters worse, some...
Themes and Styles


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 02:25.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App