private void btn_getOne_Click(object sender, EventArgs e) { //string kund_ID = listBox1.SelectedValue.ToString(); Behov för variant #1 string kund_ID = listBox1.SelectedItem.ToString(); MySqlCommand enKundCmd = Kunder.generateSelectCmd(kund_ID); DataRow dr = dbKomm.SelectOneCommand(enKundCmd); Kunder k = new Kunder(dr); label1.Text = "Kunduppgifter: " + Environment.NewLine + k.ToString(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { DataGridViewRow row = dataGridView1.Rows[e.RowIndex]; // hämta hela raden string kundID = row.Cells[0].Value.ToString(); MySqlCommand enKundCmd = Kunder.generateSelectCmd(kundID); DataRow dr = dbKomm.SelectOneCommand(enKundCmd); Kunder k = new Kunder(dr); label1.Text = "Kunduppgifter: " + Environment.NewLine + k.ToString(); } }