DataGridView 单击赋值
void dataGridView1_Click(object sender, EventArgs e) { M_int_judge = 1; btnSave.Enabled = true; btnSave.BackColor = this.BackColor; btnDelete.Enabled = true; btnDelete.BackColor = this.BackColor; txtUserID.Text = Convert.ToString(dataGridView1[0, dataGridView1.CurrentCell.RowIndex].Value).Trim(); txtUserName.Text = Convert.ToString(dataGridView1[1, dataGridView1.CurrentCell.RowIndex].Value).Trim(); txtUserPwd.Text = Convert.ToString(dataGridView1[2, dataGridView1.CurrentCell.RowIndex].Value).Trim(); cboxURight.Text = Convert.ToString(dataGridView1[3, dataGridView1.CurrentCell.RowIndex].Value).Trim(); }
清清软件园 http://sillysoft.taobao.com