// 点击Grid 填充数据 private void DataGridView1_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { textBox1.Text = otherFunction.GetSelectValue(dataGridView1)[0]; oldAdminName = textBox1.Text; if (otherFunction.GetSelectValue(dataGridView1)[2] == "True") { radioButton1.Select(); } else { radioButton2.Select(); } if (otherFunction.GetSelectValue(dataGridView1)[3] == "True") { radioButton3.Select(); } else { radioButton4.Select(); } button2.Enabled = true; button3.Enabled = true; } }
private void DataGridView1_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { // 填充学号 textBox1.Text = otherFunction.GetSelectValue(dataGridView1)[0]; oldStuNo = textBox1.Text; // 填充姓名 textBox2.Text = otherFunction.GetSelectValue(dataGridView1)[1]; oldStuName = textBox2.Text; // 填充部门 for (int i = 0; i < departArry.Length; i++) { if (departArry[i] == otherFunction.GetSelectValue(dataGridView1)[2]) { comboBox1.SelectedIndex = i; } } // 填充职位 for (int i = 0; i < posttArry.Length; i++) { if (posttArry[i] == otherFunction.GetSelectValue(dataGridView1)[3]) { comboBox2.SelectedIndex = i; break; } } // 填充班级 textBox4.Text = otherFunction.GetSelectValue(dataGridView1)[4]; // 填充性别 if (otherFunction.GetSelectValue(dataGridView1)[5] == "男") { radioButton1.Select(); } else { radioButton2.Select(); } // 生日 dateTimePicker1.Value = Convert.ToDateTime(otherFunction.GetSelectValue(dataGridView1)[6]); // 加入日期 dateTimePicker2.Value = Convert.ToDateTime(otherFunction.GetSelectValue(dataGridView1)[7]); // 联系方式 textBox3.Text = otherFunction.GetSelectValue(dataGridView1)[8]; // 是否在职 if (otherFunction.GetSelectValue(dataGridView1)[9] == "True") { radioButton4.Select(); } else { radioButton5.Select(); } // 激活按钮 button2.Enabled = true; button3.Enabled = true; } }
// 点击table 填充数据 激活按钮 private void DataGridView1_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { OtherFunction otherFunction = new OtherFunction(); label2.Text = otherFunction.GetSelectValue(dataGridView1)[0]; textBox1.Text = otherFunction.GetSelectValue(dataGridView1)[1]; button1.Enabled = true; button2.Enabled = true; textBox1.Enabled = true; } }
private void DataGridView1_Click(object sender, EventArgs e)//表单被点击获取数据并赋值 { String[] selectValue = otherFunction.GetSelectValue(dataGridView1); atId = selectValue[0]; richTextBox1.Text = selectValue[1]; textBox2.Text = selectValue[2]; textBox3.Text = selectValue[3]; textBox5.Text = selectValue[4]; textBox6.Text = selectValue[5]; richTextBox2.Text = selectValue[6]; button2.Enabled = true; button3.Enabled = true; }
private void DataGridView1_Click(object sender, EventArgs e)//获取活动表单数据 { if (dataGridView1.RowCount != 0) { String[] selectValue = otherFunction.GetSelectValue(dataGridView1); textBox1.Text = selectValue[1]; oldName = selectValue[1]; textBox2.Text = selectValue[2]; dateTimePicker1.Value = Convert.ToDateTime(selectValue[3]); textBox3.Text = selectValue[4]; richTextBox1.Text = selectValue[5]; button2.Enabled = true; button3.Enabled = true; acId = selectValue[0]; } }
private void DataGridView2_Click(object sender, EventArgs e)//将表单选择的名字赋值给文本框 { textBox1.Text = otherFunction.GetSelectValue(dataGridView2)[1]; }