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();
        }

 

posted @ 2013-07-30 14:09  乡香田甜  阅读(486)  评论(0编辑  收藏  举报