private void buttonSelectIDContact_Click_1(object sender, EventArgs e) { SelectContactForm SelectContactF = new SelectContactForm(); SelectContactF.ShowDialog(); try { int contactId = Convert.ToInt32(SelectContactF.dataGridViewSelectContact.CurrentRow.Cells[0].Value.ToString()); Contact contact = new Contact(); DataTable table = contact.getContactById(contactId); textBoxIDContact.Text = table.Rows[0]["id"].ToString(); textBoxFname.Text = table.Rows[0]["firstname"].ToString(); textBoxLname.Text = table.Rows[0]["lastname"].ToString(); comboBoxGroupId.SelectedValue = table.Rows[0]["group_id"]; textBoxPhone.Text = table.Rows[0]["phone"].ToString(); textBoxMail.Text = table.Rows[0]["email"].ToString(); textBoxAddress.Text = table.Rows[0]["address"].ToString(); byte[] pic = (byte[])table.Rows[0]["picture"]; MemoryStream picture = new MemoryStream(pic); pictureBoxContactImage.Image = Image.FromStream(picture); pictureBoxContactImage.SizeMode = PictureBoxSizeMode.StretchImage; } catch (Exception) { } }
private void buttonSeclectContact_Click(object sender, EventArgs e) { SelectContactForm form = new SelectContactForm(); form.ShowDialog(); try { textBoxContactID.Text = form.dataGridViewSelectContact.CurrentRow.Cells[0].Value.ToString(); } catch (Exception) { throw; } }