0

我只是想问一下,当我想通过单击 a 将数据传递到弹出窗口时,我将如何Column编码DataGridView。请帮忙!

try
{
    Lessee_Message frm = new Lessee_Message(
        dataGridView1.CurrentRow.Cells["ID"].Value.ToString())); 
    frm .ShowDialog();
}
catch(Exception a) { }

这段代码有什么问题?

4

1 回答 1

0

您必须以 Lessee_Message 形式创建一个重载的构造函数,以将字符串作为参数传递。

Lessee_Message 应该是这样的:

public partial class Lessee_Message : Form
{    
//This is only for further use. only to pass a parameter, the private field is not required.
private string _id="";
 public Lessee_Message (string id)
 {
_id=id;
 InitializeComponent ();
 }

}
于 2013-09-04T10:53:38.490 回答