title: Late binding and Option Strict
body: <p>I have this problem with late binding: I am creating a grocery list application. I have a class named <code>Item</code> which stores the <code>name</code>, <code>price</code>, <code>quantity</code>, and <code>description</code> of an item on the grocery list. </p>
  
  <p>I have a module named <code>ListCollection</code> which defines a <code>Collection</code> of <code>Item</code> objects. I have created an <code>Edit</code> form which will automatically display the currently selected <code>ListCollection</code> item properties, but whenever I attempt to fill the text boxes, it tells me that <code>Option Strict</code> disallows late binding. </p>
  
  <p>I COULD take the easy route and disable <code>Option Strict</code>, but I'd prefer to figure out what the problem is so I know for future reference.</p>
  
  <p>I shall paste pertinent code here. (Late binding error is in <code>EditItem.vb</code>.)</p>
  
  <p>Item.vb code:</p>
  
  <pre><code>' Member variables:
  Private strName As String
  
  ' Constructor
  Public Sub New()
      strName = ""
  
  ' Name property procedure
  Public Property Name() As String
      Get
          Return strName
      End Get
      Set(ByVal value As String)
          strName = value
      End Set
  End Property
  </code></pre>
  
  <p>ListCollection.vb code:</p>
  
  <pre><code>' Create public variables.
  Public g_selectedItem As Integer ' Stores the currently selected collection item.
  
  ' Create a collection to hold the information for each entry.
  Public listCollection As New Collection
  
  ' Create a function to simplify adding an item to the collection.
  Public Sub AddName(ByVal name As Item)
      Try
          listCollection.Add(name, name.Name)
      Catch ex As Exception
          MessageBox.Show(ex.Message)
      End Try
  End Sub
  </code></pre>
  
  <p>EditItem.vb code:</p>
  
  <pre><code>Private Sub EditItem_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
      ' Set the fields to the values of the currently selected ListCollection item.
      txtName.Text = ListCollection.listCollection(g_selectedItem).Name.Get ' THIS LINE HAS THE ERROR!
  </code></pre>
  
  <p>I have tried declaring a <code>String</code> variable and assigning the <code>Item</code> property to that, and I have also tried grabbing the value directly from the <code>List</code> item (not using the <code>Get</code> function), and neither of these made a difference.  </p>
  
  <p>How can I fix this problem? </p>