I need help with a bit of code. It turns out that I have a combobox that I fill using a database:
private void frmMain_Load(object sender, EventArgs e)
{
//TEXT BOX DISABLED
txtDv.Enabled = false;
txtNombre.Enabled = false;
txtApellido.Enabled = false;
txtCorreo.Enabled = false;
txtTelefono.Enabled = false;
//LLENAR COMBOBOX DESDE BD
using (SqlConnection conn = new SqlConnection("Data Source = DESKTOP-0PSJQKP; initial Catalog = BDControlEPP; User = sa; Password = a123456"))
{
try
{
string query = "select idItem, nombreItem from tblItems";
SqlDataAdapter da = new SqlDataAdapter(query, conn);
conn.Open();
DataSet ds = new DataSet();
da.Fill(ds, "Items");
cbItems.DisplayMember = "nombreItem";
cbItems.ValueMember = "idItem";
cbItems.DataSource = ds.Tables["Items"];
}
catch (Exception)
{
throw;
}
}
}
And I need to capture the selected item in the combobox with an ADD button that I have beside it, plus a text box next to it that would indicate the amount I want of that item and insert it into a Listview in the same form.
I remain attentive to any response, greetings!