每当我单击行的单元格时,如何将数据填充到文本字段中?
对于标准 DataGridView 我可以使用以下代码
void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
txtguard_id.Text = dataGridView1.SelectedRows[0].Cells["GuardId"].Value.ToString();
DateHired.Value = (DateTime)dataGridView1.SelectedRows[0].Cells["DateHired"].Value;
Firstname.Text = dataGridView1.SelectedRows[0].Cells["FirstName"].Value.ToString();
Middlename.Text = dataGridView1.SelectedRows[0].Cells["MiddleName"].Value.ToString();
Lastname.Text = dataGridView1.SelectedRows[0].Cells["LastName"].Value.ToString();
txtguard_street.Text = dataGridView1.SelectedRows[0].Cells["Street"].Value.ToString();
txtguard_brgy.Text = dataGridView1.SelectedRows[0].Cells["Barangay"].Value.ToString();
txtguard_procity.Text = dataGridView1.SelectedRows[0].Cells["ProvinceorCity"].Value.ToString();
txtguard_age.Text = dataGridView1.SelectedRows[0].Cells["Age"].Value.ToString();
txtguard_bday.Value= (DateTime)dataGridView1.SelectedRows[0].Cells["Birthdate"].Value;
txtguard_male.Checked = (bool)dataGridView1.SelectedRows[0].Cells["Gender"].Value;
txtguard_female.Checked = (bool)dataGridView1.SelectedRows[0].Cells["Gender"].Value;
}
但在 GridControl 我不知道该怎么做......