我有一个问题伙伴,我希望你能帮助我..
我想将所选数据行显示到我的文本框和复选框,我有一个问题与CheckBox和错误不能隐含转换类型字符串为bool
保存到数据库后,我将我的Checkbox设置为true或false,这样它将在我的Datagridview中显示True或False not Checked,如果它经历了Case,则Checkbox是Option ...
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;
}
}
在我的鼠标单击事件中
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();