更新时间:2023-11-22 18:18:40
具体如何执行此操作取决于表单之间的关系:如果您创建一个一个在另一个的实例,然后第一个是父母,第二个是孩子:
在两种形式之间传递信息,第1部分:父母对儿童 [ ^ ]
在两种形式之间传递信息,第2部分:儿童到父母 [ ^ ]
在两种表格之间传递信息,第3部分:儿童与儿童 [ ^ ]
Exactly how you do this depends on the relationship between the forms: If you create an instance of one in another, then the first is the parent, the second is the child:
Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
Transferring information between two forms, Part 3: Child to Child[^]
将EditRecord表单的构造函数更改为接受一个字符串作为参数。
Change your EditRecord form's constructor to accept a string as a parameter.
private string GUID;
public EditRecord(string GUID)
{
this.GUID = GUID;
}
然后当你在Form1中初始化EditRecord时,将值传递给构造函数。
Then when you initialise EditRecord in Form1 pass the value into the constructor.
EditRecord editRecord = new EditRecord(GUID);
editRecord.Visible = true