我要完成的工作是打开一个新的Windows表单,单击学生姓名时已填充我的sqlite数据,以编辑或删除数据。单击特定行后,如何在编辑表单中填充数据?指向“编辑”表单的链接已创建。
单击“名字”列中的任何名字后,将打开以下窗口。
我假设这与我的单元格内容单击功能有关,该如何实现?
private void dataGridView1_CellContentClick_2(object sender, DataGridViewCellEventArgs e)
{
string ExePath = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath;
string drive = Path.GetPathRoot(ExePath);
if (e.RowIndex == -1 || e.ColumnIndex == 0)
{
this.Hide();
editStudent editStudent = new editStudent();
editStudent.Show();
}
else
{
}
if (e.RowIndex == -1 || e.ColumnIndex != 6) //ignore header row and any column that doesnt have file name
return;
var fileName = @"" + drive + "WindowsFormsApplication1\\PDF\\" + dataGridView1.CurrentCell.Value.ToString() + "\\" + dataGridView1.CurrentCell.Value.ToString() + ".pdf";
if (File.Exists(fileName))
{
Process.Start(fileName);
}
else
{
MessageBox.Show("File Does Not Exist");
}
}
弄清楚了..
editStudent editStudent = new editStudent();
editStudent.firstName.Text = dataGridView1.CurrentRow.Cells["First Name"].Value.ToString();
editStudent.ShowDialog();
这是我在单元格内容单击功能中使用的代码。
谢谢大家的帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句