我通过Toolstrip打开另一个表单,输入Mainform中需要的用户名(并在Mainform中声明为String)
主体代码:
private void toolStripButton6_Click(object sender, EventArgs e)
{
using (Form frm = new Form3())
{
frm.FormBorderStyle = FormBorderStyle.FixedDialog;
frm.StartPosition = FormStartPosition.CenterParent;
if (frm.ShowDialog() == DialogResult.OK)
{
Username = frm.ReturnValue1;
}
}
}
Run Code Online (Sandbox Code Playgroud)
Form3代码:
public string ReturnValue1 {
get
{
return textBox1.Text;
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
Run Code Online (Sandbox Code Playgroud)
C#告诉我没有frm.ReturnValue1 :(
我想加入3个具有以下格式的列表:
List1:
CountryID | CountryData | regionUID
===================================
12 | Has good gras | 4567
12 | nice weather | 6789
16 | stormy weather | 1234
List2:
CountryID | CountryName
=======================
12 | green hill
16 | stormy mountain
List3:
regionUID | regionName
=======================
4567 | above 1000feet
6789 | on the ground
1234 | on the hill
Run Code Online (Sandbox Code Playgroud)
输出应如下所示:
CountryName | CountryData | regionName
==============================================
green hill | Has good gras | above 1000feet
green hill | nice weather …Run Code Online (Sandbox Code Playgroud)