this mi CLASS function
This my button to fill a listbox
the things is the listbox1 result is this
aves.getsetaves
aves.getsetaves
aves.getsetaves
aves.getsetaves
is the number of rows from my database it suppose to return ID and tipoave

VB.NET:
Public Function getlista() As ArrayList
Dim milista As New ArrayList
Dim conexion As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\am103208_avicultura.mdb;Persist Security Info=False")
conexion.Open()
Dim comando As New OleDb.OleDbCommand
comando.CommandText = String.Format("Select id,tipoave,peso,edad from aves")
comando.Connection = conexion
Dim lector As OleDb.OleDbDataReader
lector = comando.ExecuteReader
While lector.Read
Dim otrabajadores As New getsetaves
otrabajadores.setid(lector(0))
otrabajadores.settipoave(lector(1))
otrabajadores.setpeso(lector(2))
otrabajadores.setedad(lector(3))
milista.Add(otrabajadores)
End While
Return milista
End Function
This my button to fill a listbox
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.ListBox1.Items.Count > 0 Then
Me.ListBox1.Items.Clear()
End If
Dim otrab As New aves.mantenimientoaves
Dim listado As New ArrayList
listado = otrab.getlista
Dim trabaja As aves.getsetaves
For Each trabaja In listado
Me.ListBox1.Items.Add(trabaja)
Next
End Sub
the things is the listbox1 result is this
aves.getsetaves
aves.getsetaves
aves.getsetaves
aves.getsetaves
is the number of rows from my database it suppose to return ID and tipoave
