【发布时间】:2016-01-30 21:36:44
【问题描述】:
我有两个表格,表格 1 和表格 2。
form1 有三个按钮,button1(vanilla)、button2(chocolate) 和 button3(nextpage)。
form2 有一个 listView1
在 form1 上,用户将单击 button1 或/和 button2。如果他们同时单击两者,我如何将其显示在 form2 上 listView1 的下一行中。
下面有一张截图说明了我的意思
public partial class form1 : Form
{
public form1()
{
InitializeComponent();
}
public static string buttonValue = "";
public static string buttonValue1 = "";
public void button1_Click(object sender, EventArgs e)
{
buttonValue = "Vanillaaaa";
}
private void button2_Click(object sender, EventArgs e)
{
buttonValue1 = "Chocolate";
}
private void button3_Click(object sender, EventArgs e)
{
form2 form2 = new form2(buttonValue + buttonValue1);
form2.Show();
this.Hide();
}
}
Form2
public partial class form2 : Form
{
private string _passedValue = "";
private string _passedValue1 = "";
public form2(string passedValue)
{
InitializeComponent();
_passedValue = passedValue;
listView1.Items.Add(_passedValue);
listView1.Items.Add(_passedValue1);
}
我希望巧克力在下一行的香草下方显示。
【问题讨论】: