private void buttonSelectContact_Click(object sender, EventArgs e)
        {
            Valitse_kontakti_Form selectContactF = new Valitse_kontakti_Form();

            selectContactF.ShowDialog();

            try
            {
                int contactId = Convert.ToInt32(selectContactF.dataGridView1.CurrentRow.Cells[0].Value.ToString());

                KONTAKTI kontakti = new KONTAKTI();

                DataTable table = kontakti.getContactById(contactId);

                textBoxContactID.Text       = table.Rows[0]["id"].ToString();
                textBoxFName.Text           = table.Rows[0]["etunimi"].ToString();
                textBoxLName.Text           = table.Rows[0]["sukunimi"].ToString();
                comboBoxGroup.SelectedValue = table.Rows[0]["ryhma id"];
                textBoxPhone.Text           = table.Rows[0]["puhelin"].ToString();
                textBoxEmail.Text           = table.Rows[0]["sahkoposti"].ToString();
                textBoxAdresse.Text         = table.Rows[0]["osoite"].ToString();

                Byte[]       kuva    = (byte[])table.Rows[0]["kuva"];
                MemoryStream picture = new MemoryStream(kuva);
                PictureBoxContactImage.Image = Image.FromStream(picture);
            }
            catch
            {
            }
        }
示例#2
0
        private void buttonSelectContact_Click(object sender, EventArgs e)
        {
            Valitse_kontakti_Form selectContactF = new Valitse_kontakti_Form();

            selectContactF.ShowDialog();

            try
            {
                int contactId = Convert.ToInt32(selectContactF.dataGridView1.CurrentRow.Cells[0].Value.ToString());
                textBoxContactId.Text = contactId.ToString();
            }
            catch
            {
            }
        }