I have a Problem Guys, I hope you help me..
I want to display the selected data row to my textbox and checkbox and I having a Problem with the CheckBox and the error Cannot implicity convert type string to bool
I set my Checkbox to true or false after saving to the Database so it will show in my Datagridview only True or False not Checked and the Checkbox is the Option if it is undergo that Case...
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
foreach (Control control in this.Controls)
{
if (control is CheckBox)
((CheckBox)(control)).Checked = true;
}
foreach (Control control in this.Controls)
{
if (control is CheckBox)
((CheckBox)(control)).Checked = false;
}
}
And in my Mouse Click Event
private void dataGridView1_MouseClick(object sender, MouseEventArgs e)
{
txtFam.Text = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
txtName.Text = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
txtSevereheadache.Checked =dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
txtBlurringvision.Checked = dataGridView1.SelectedRows[0].Cells[3].Value.ToString();
txtAbdominal.Checked = dataGridView1.SelectedRows[0].Cells[4].Value.ToString();
txtSeverevomiting.Checked = dataGridView1.SelectedRows[0].Cells[5].Value.ToString();
txtBreathingdifficulty.Checked = dataGridView1.SelectedRows[0].Cells[6].Value.ToString();
txtConvulsion.Checked = dataGridView1.SelectedRows[0].Cells[7].Value.ToString();
txtEdema.Checked = dataGridView1.SelectedRows[0].Cells[8].Value.ToString();
txtVaricosities.Checked = dataGridView1.SelectedRows[0].Cells[9].Value.ToString();
txtFeverchills.Checked = dataGridView1.SelectedRows[0].Cells[10].Value.ToString();
txtPain.Checked = dataGridView1.SelectedRows[0].Cells[31].Value.ToString();