I'm a VB.NET novice and am having difficulty retrieving collection data.
I have a combobox using a collection as the datasource:
Dim PrinterCollection As New Collection
Me.ComboBox1.DataSource = PrinterCollection
Me.ComboBox1.SelectedIndex = 0
On SelectIndexChanged I would like to display the contents of the collection depending on what is selected in ComboBox1, but I'm not sure how to access the collection data:
Public Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
'Me.Label1.Text = PrinterCollection(Me.ComboBox1.SelectedIndex) -- does not work
Also, should I declare the variable PrinterCollection in a module to set it as a global variable? The variable scope differences between VB6 and VB.NET have me a bit confused.