110,571
社区成员
发帖
与我相关
我的任务
分享
public List<string> GetAppNameList()
{
List<string> arrAppName = new List<string>();
foreach (ListViewItem lvi in lvApp.Items)
{
arrAppName.Add(lvi.Tag.ToString());
}
return arrAppName;
}
B cf = new B();
List<string> cf = cf.GetAppNameList();
//A窗体有个方法GetAppNameList,当A窗体切换到B窗体时这样写
B b = new B(this);
B.ShowDialog();
//在B窗体首先要接收这个窗体参数
public Form1 f;
public B(A form)
{
InitializeComponent();
this.f = form;
}
private void Button_Click(object sender, EventArgs e)
{
f.GetAppNameList();
}
public List<string> GetAppNameList()
{
List<string> arrAppName = new List<string>();
foreach (ListViewItem lvi in lvApp.Items)
{
arrAppName.Add(lvi.Tag.ToString());
}
return arrAppName;
}
public List<string> GetAppNameList()
{
Console.writeLine("lvApp.Items.Count: {0}",lvApp.Items.Count);
List<string> arrAppName = new List<string>();
foreach (ListViewItem lvi in lvApp.Items)
{
arrAppName.Add(lvi.Tag.ToString());
}
return arrAppName;
}