title: convert VBA to vb.net
body: <p>I am migrating my application from VBA to VB.</p>
  
  <p>I am writing my code from scratch. I have a piece of code in VBA which uses dictionary. Can someone help me how to convert this in VB. I am unable to do so.</p>
  
  <p>Also is there any easy way to convert VBA code to VB rather than writing it from scratch.</p>
  
  <p>Many thanks.</p>
  
  <p>Code:</p>
  
  <pre><code>public FunctionCalldctionary()
      Dim  myDict As Dictionary
      SetMyDictionary pDict
  End Function
  
  Private Sub SetMyDictionary (tempDict As Dictionary)
      Dim v As Variant
      Dim i As Long, numAs Long
  
      Set inDict = New Dictionary
  
      ' Loop through each entry in the list, adding to the dictionary
      numcosts = 0
      For i = 1 To 12
          If v(i, 1) &lt;&gt; "" Then
              numAs = numAs + 1
              inDict.Add v(i, 1), numAs 
          End If
      Next i
  End Sub
  </code></pre>
  
  <p>I am not sure how to declare and use this dictionary in VB.</p>