I have two objects of BindingSource and Dictionary. And BindingSource Object contains the Object of List of Vehicles Class Object and Dictionary Object contains the BindingSource Class Object. And here is the global declaration:
Dim bs As BindingSource
Dim dicBinding As Dictionary(Of Integer,BindingSource)
and when user click button named "Add" I add object of Vehicle Class to bs and then add bs to dicBinding:
If bs Is Nothing Then bs = New BindingSource(New List(Of Vehicle),Nothing)
If dicBinding is Nothing Then dicBinding = New Dictionary(Of integer,BindingSource)
Dim i As Integer = dicBinding.Count
dicBinding.Add(i,bs)
when I want to retrieve the BindingSource Object from dicBinding Object:
bs =TryCast(dicBinding.Item(0),BindingSource)
For Each v As Vehicle In bs.List
MessageBox.Show(v.VehicleId)
Next
But I can't retrieve. Could anyone help me?