2 Replies - 135 Views - Last Post: 03 February 2012 - 08:18 PM Rate Topic: -----

Topic Sponsor:

#1 deanobravo  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 99
  • Joined: 02-January 12

sender as object intellisense only lists 5 Methods and no properties

Posted 03 February 2012 - 07:32 PM

Hi
Just after a bit of clarification.
When you type sender. intellisense lists 5 methods and yet if you type sender.Left or sender.top these will work.
Why don't these properties show up as available for use via intellisense.
I only discovered you could use these properties when I read a tutorial on this site.

Thanks

This post has been edited by deanobravo: 03 February 2012 - 07:33 PM

Is This A Good Question/Topic? 0
  • +

Replies To: sender as object intellisense only lists 5 Methods and no properties

#2 smohd  Icon User is offline

  • Critical Section
  • member icon



Reputation: 1644
  • View blog
  • Posts: 4,126
  • Joined: 14-March 10

Re: sender as object intellisense only lists 5 Methods and no properties

Posted 03 February 2012 - 08:09 PM

Because sender is type Object at that time, and those shown are the one available in Object class. When you pass it as Object, intellisense cant tell what type it is except that it is object and so it will show you object properties. If you need to get all available properties, parse a sender to its appropriate type.
It dont give error because Vb change it for you at the time, but consider as a good behavior to change to its specific type before using other Object's subclass methods. This is what we do when we deal with polymorphism.
Was This Post Helpful? 1
  • +
  • -

#3 deanobravo  Icon User is offline

  • D.I.C Head

Reputation: 13
  • View blog
  • Posts: 99
  • Joined: 02-January 12

Re: sender as object intellisense only lists 5 Methods and no properties

Posted 03 February 2012 - 08:18 PM

Makes perfect sense.
Thanks.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1