Quantcast
Channel: Llenar un ListView de un DataSet
Viewing all articles
Browse latest Browse all 5

Llenar un ListView de un DataSet

$
0
0

@Armando Rodas

También puedes usar una lista genérica para poder cargar los datos en el ListView

Public Shared Function GetProductosLV() As List(Of ProductoEntity)
            Using cn As SqlConnection = Conexion.Conectar("default")
                cn.Open()
                Using cmd As SqlCommand = cn.CreateCommand()
                    cmd.CommandText = "SELECT Producto_Id, Nombre FROM Productos WHERE Producto_Id > 000009"
                    Dim producto As List(Of ProductoEntity) = new List(Of ProductoEntity)()
                    Using reader As SqlDataReader = cmd.ExecuteReader()
                        While reader.Read() 
                            Dim p As New ProductoEntity()
                                Producto_Id = Convert.ToString(reader("Producto_Id")), Nombre = Convert.ToString(reader("Nombre")),
                            End While
                            End using

                            producto.Add(p)

                        End using

                    End using
                    Return producto

                End Function



Presentacion

lista = Producto.GetProductosLV()
            For Each row in lista
                Dim items As New ListViewItem(row.Producto_Id)
            Next
                items.SubItems.Add(row.Nombre)
                lisvProductos.Items.Add(items)

Espero te sirva de ayuda.

Nota: En tu caso no uses parámetros, modifica el ejemplo a tus necesidades.


Pedro Ávila
"El hombre sabio querrá estar siempre con quien sea mejor que él."
Lima - Perú



Viewing all articles
Browse latest Browse all 5

Trending Articles


Girasoles para colorear


mayabang Quotes, Torpe Quotes, tanga Quotes


Tagalog Quotes About Crush – Tagalog Love Quotes


OFW quotes : Pinoy Tagalog Quotes


Long Distance Relationship Tagalog Love Quotes


Tagalog Quotes To Move on and More Love Love Love Quotes


5 Tagalog Relationship Rules


Best Crush Tagalog Quotes And Sayings 2017


Re:Mutton Pies (lleechef)


FORECLOSURE OF REAL ESTATE MORTGAGE


Sapos para colorear


tagalog love Quotes – Tiwala Quotes


Break up Quotes Tagalog Love Quote – Broken Hearted Quotes Tagalog


Patama Quotes : Tagalog Inspirational Quotes


Pamatay na Banat and Mga Patama Love Quotes


Tagalog Long Distance Relationship Love Quotes


BARKADA TAGALOG QUOTES


“BAHAY KUBO HUGOT”


Vimeo 10.7.0 by Vimeo.com, Inc.


Vimeo 10.7.1 by Vimeo.com, Inc.



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>