[AccessD] First real stumble with using VB.Net over VB

Drew Wutka DWUTKA at Marlow.com
Thu Apr 14 00:44:08 CDT 2011


Ok, thanks.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte Foust
Sent: Thursday, April 14, 2011 12:36 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] First real stumble with using VB.Net over VB

You just have to be aware that there are times to use the fields collection and times not to.  If you're looking for a property, it's probably OK, but if you want the value, you have to be careful which event you use.

Charlotte Foust

On Wed, Apr 13, 2011 at 8:49 PM, Drew Wutka <DWUTKA at marlow.com> wrote:
> Does it affect anything other than Reflection?
>
> Drew
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Charlotte 
> Foust
> Sent: Wednesday, April 13, 2011 6:06 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] First real stumble with using VB.Net over VB
>
> Yep, that confuses everyone until you get used to it.
>
> Charlotte Foust
>
> On Wed, Apr 13, 2011 at 3:22 PM, Drew Wutka <DWUTKA at marlow.com> wrote:
>> Figured I'd post this here, for those that may be tinkering or 
>> thinking about tinkering with .Net.
>>
>>
>>
>> In VB, one of the 'limitations' that was kind of annoying was 
>> dynamically referring to the 'properties' of a class module.
>>
>>
>>
>> For example, if I wanted the column name from a recordset, I could do
>> this:
>>
>>
>>
>> Msgbox rs.Fields.Item(0).Name
>>
>>
>>
>> But, what if I wanted to get it programmatically, .Name is hard coded:
>>
>>
>>
>> Msgbox rs.Fields.Item(0).Properties("BASECOLUMNNAME")
>>
>>
>>
>> That would allow me to put a variable in the properties 'property', 
>> to retrieve a value dynamically.
>>
>>
>>
>> However, with a standard class module, in VB6/VBA, the only way, I 
>> could find, to do this, was to put in extra code into a class module 
>> to create a 'Properties' Property.  In fact, I had written an Add-on 
>> in VB6 that did this for me (created a properties property).  Put a 
>> LOT of extra code into your module though.
>>
>>
>>
>> In VB.Net, there is a built in capability to do this with the 
>> Reflection Library.  So here is what I stumbled on.  I was all 
>> excited to use the Reflection library on a particalur class where I 
>> needed to dynamically list, set, and get properties of a class I built.....
>>
>>
>>
>> The catch...
>>
>>
>>
>> In VB:
>>
>>
>>
>> Public SomeValue as String
>>
>> -           And -
>>
>> Property Get SomeValue() as string
>>
>> SomeValue=strTemp
>>
>> End Property
>>
>>
>>
>> Both create a 'property' called SomeValue.
>>
>>
>>
>> In VB.Net
>>
>> Public SomeValue as String
>>
>> Public Property SomeValue() as String
>>
>>               Get
>>
>>                               Return strTemp
>>
>>                End Get
>>
>>                Let (value)
>>
>>                                strTemp=value
>>
>>                End Let
>>
>> End Property
>>
>>
>>
>> In the first line, SomeValue is considered a FIELD, not a property.  
>> The SomeValue defined with Get/Let statements...THAT'S a PROPERTY.
>>
>>
>>
>> Go figure.  Drove me nuts, couldn't figure out why I wasn't getting 
>> at all of my properties...until I figured out that some were 
>> properties some were "FIELDS".
>>
>>
>>
>> LOL.
>>
>>
>>
>> Of course, there will probably be a dozen people that already knew 
>> that...I'm so late to the game with .Net
>>
>>
>>
>> Drew
>>
>>
>> The information contained in this transmission is intended only for 
>> the person or entity to which it is addressed and may contain II-VI 
>> Proprietary and/or II-VI Business Sensitive material. If you are not 
>> the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy.
>> You are notified that any review, retransmission, copying, 
>> disclosure, dissemination, or other use of, or taking of any action 
>> in reliance upon this information by persons or entities other than the intended recipient is prohibited.
>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com The information contained in 
> this transmission is intended only for the person or entity to which 
> it is addressed and may contain II-VI Proprietary and/or II-VI 
> Business Sensitive material. If you are not the intended recipient, 
> please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy.
> You are notified that any review, retransmission, copying, disclosure, 
> dissemination, or other use of, or taking of any action in reliance 
> upon this information by persons or entities other than the intended recipient is prohibited.
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
The information contained in this transmission is intended only for the person or entity 
to which it is addressed and may contain II-VI Proprietary and/or II-VI Business 
Sensitive material. If you are not the intended recipient, please contact the sender 
immediately and destroy the material in its entirety, whether electronic or hard copy. 
You are notified that any review, retransmission, copying, disclosure, dissemination, 
or other use of, or taking of any action in reliance upon this information by persons 
or entities other than the intended recipient is prohibited.





More information about the AccessD mailing list