How To Add Or Insert Data From Radio Button To Datagridview In C Sharp Windows Application

How To Add Or Insert Data From Radio Button To Datagridview In C# Windows Application

How To Add Or Insert Data From Radio Button To Datagridview In C# Windows Application
How To Add Or Insert Data From Radio Button To Datagridview
How To Add Or Insert Data From Radio Button To Datagridview

This Tutorial shows How To Add Or Insert Data From Radio Button To Datagridview In C# Windows Application

C# SOURCE CODE

       private void button2_Click(object sender, EventArgs e)
        {
            String firstName = textBoxFirstName.Text;
            String lastName = textBoxLastName.Text;
            String gender = "";
            String country = "";

            if (radioButtonGenderMale.Checked == true)
            {
                gender = "Male";
            }
            else if (radioButtonGenderFemale.Checked == true)
            {
                gender = "Female";
            }

            country = comboBoxCountry.SelectedItem.ToString();

            MemoryStream ms = new MemoryStream();

            pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
            Byte[] img = ms.ToArray();

            dataGridView1.Rows.Add(firstName, lastName, gender, country, imagePath, img);

            //dataGridView1.DataSource = table;
        }

Leave a Reply

Your email address will not be published. Required fields are marked *