private void button3_Click(object sender, EventArgs e) { LogicaGo logica = new LogicaGo(); lbGastos.DataSource = logica.obtenerListaGastos(txtDpFechaIni.Text, txtDpFechaFin.Text); if (lbGastos.Items.Count > 0) { lbGastos.SelectedIndex = 0; } lbGastos.DisplayMember = "Nombre"; lbGastos.ValueMember = "Id"; }
public void cargarGastos() { LogicaGo logica = new LogicaGo(); lbGastos.DataSource = logica.obtenerListaGastos(txtFiltro.Text); if (lbGastos.Items.Count > 0) { lbGastos.SelectedIndex = 0; } lbGastos.DisplayMember = "Nombre"; lbGastos.ValueMember = "Id"; }