Dopo aver studiato l'utilizzo delle classi mi è sicuramente più chiaro il codice che ho scritto sopra, e sono riuscito ad usarle per le mie esigenze, però adesso ho un problema che non so come risolvere.
Ho popolato un list box nel modo che vi posterò adesso, e vorrei che alla selezione di un elemento nel listbox si aggiornino alcuni campi testo con i dettagli di quell item selezionato.
il codice che ho scritto è questo, la classe è un pò lunga ma è sempre la stessa:
Questa è la classe:
codice:
Public Class bordi
    Private Vtipo As String
    Private VR As String
    Private VA As String
    Private VB As String
    Private Vfissaggio As String

    Property tipo() As String
        Get
            Return Vtipo
        End Get
        Set(ByVal Value As String)
            Vtipo = Value
        End Set
    End Property

    Property R() As String
        Get
            Return VR
        End Get
        Set(ByVal Value As String)
            VR = Value
        End Set
    End Property

    Property A() As String
        Get
            Return VA
        End Get
        Set(ByVal Value As String)
            VA = Value
        End Set
    End Property

    Property B() As String
        Get
            Return VB
        End Get
        Set(ByVal Value As String)
            VB = Value
        End Set
    End Property

    Property Fissaggio() As String
        Get
            Return Vfissaggio
        End Get
        Set(ByVal Value As String)
            Vfissaggio = Value
        End Set
    End Property

End Class
E questo è il codice del form
codice:
Private Sub CaricaBordi()
        Try
            Dim MyCmd As SqlClient.SqlCommand
            Dim MyDr As SqlClient.SqlDataReader
            Dim MySQL As String
            Dim MyProdotto As bordi

            myConn.Open()

            MySQL = "SELECT *FROM tab_bordiV"
            MyCmd = New SqlClient.SqlCommand(MySQL)
            MyCmd.Connection = myConn

            MyDr = MyCmd.ExecuteReader

            lstElenco.Items.Clear()

            Do While MyDr.Read

                MyProdotto = New bordi

                With MyDr
                    MyProdotto.tipo = .Item("tipo")
                    MyProdotto.R = .Item("a")
                    MyProdotto.A = .Item("a")
                    MyProdotto.B = .Item("b")
                    MyProdotto.Fissaggio = .Item("fissaggio")


                End With

                lstElenco.Items.Add(MyProdotto.tipo)

            Loop
            myConn.Close()


        Catch ex As Exception
            MessageBox.Show(ex.Message & " " & ex.StackTrace)
        End Try

    End Sub
Avevo provato a fare una cosa di questo tipo
codice:
                txtTipo.Text = lstElenco.SelectedItem(MyProdotto.tipo)
Ma mi da errore...
sapete darmi qualche suggerimento per come posso risolvere questa cosa?
Grazia tutti