假设Form1中有DataGrid1,显示:
学校名称 班级
学校1 1
学校1 2
学校1 3
学校2 1
学校2 2
…… …… 希望选择了DataGrid1的某一行(假设为上面的第三行)后,双击DataGrid1,打开新窗口Form2,Form2中有DataGrid2,显示: 班级 学生 性别
3 甲 男
3 乙 女
…… 如何写代码将所选择的行的参数带入Form2 ? 我很菜,希望能得到具体一些的指点。
解决方案 »
- C# 单元测试 没有执行
- bs.DataSource = null: 无法绑定到 DataSource 的属性或列 Name。参数名: dataMember
- 急急急.....在线等..................
- WinForm ComboBox控件避免重复问题
- 关于窗口打开的问题
- 自定义控件 如何给picturebox添加Font属性
- 高手们,请问怎样提取windows中纸牌的图片啊?
- c#调用外部动态连接库的问题
- 如何取得小数点后面指定位数的数字.
- 发邮件时出现:Could not access CDO NewMail object
- (急求)请教如何能使我的datetime类型转换成int类型
- mdi程序中,如何让某一个子窗口只出现一个实例?
private string xx="";
public string xx_value
{
get{return xx;}
set{xx=value;}
}
这样在new 出FORM2的时候设置xx_value的值,然后在FORM2中取出XX的值就可以了,这样值就传好了!
谢谢趴趴熊,但是我还想知道怎样取出DataGrid1中班级的编号假设数据库中有三张表,学校表School 字段有:school_id, school_name班级表Class 字段有:class_id, school_id, class_name学生表Student 字段有:student_id, class_id, student_name, student_sexDataGrid1中显示的是School.school_name和Class.class_name 用的数据源是DataView,我选定一行以后如何在双击事件中取得选定行的class_id ?
有没有人知道怎样取出没有显示在DataGrid的那一个class_id字段呀?
至于第三个字段class_id ,你可以添加一个 DataGridTextBoxColumn()
把这个列的 width 设为 0然后, 通过 DataGrid1[DataGrid1.CurrentRowIndex, 0]
DataGrid1[DataGrid1.CurrentRowIndex, 1]
DataGrid1[DataGrid1.CurrentRowIndex, 2]的值,把 这些内容 传给 DataGrid2 的某些属性...
然后再进行其他操作..