Results 1 to 3 of 3

Thread: Possible to get around this late binding?

  1. #1

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704

    Possible to get around this late binding?

    I have a class which holds a collection of objects defined by another class.

    The collection class is ManufacturerCollection

    The object class is Manufacturer

    In the ManufacturerCollection class... I am trying to get around late-binding this method, but don't see a way how:

    VB Code:
    1. Public Function GetManufName(ByVal index As Integer) As String
    2.  
    3.         Return InnerList.Item(index).Name
    4.  
    5. End Function

    This function returns the name of the manufacturer object listed at that index inside the ManufacturerCollection object.

    I can get it to work with Option Strict Off, but with it on, I get a late-bounding warning... I would prefer not to do late-binding, but I'm not sure if its even possible to get around it.

  2. #2
    Lively Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    95
    not sure if i'm barking up the wrong tree but can't you do...

    Code:
    Public Function GetManufName(ByVal index As Integer) As String
    
            Dim m as Manufacturer = CType(InnerList.Item(index), Manufacturer)
            Return m.Name
    
    End Function

  3. #3

    Thread Starter
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Thanks Shutty, you nailed it! I actually had written the code like that earlier in a different class, but never noticed it.... mornings...
    Last edited by nemaroller; May 7th, 2003 at 09:46 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width