C#选择listview显示的一行,点击button弹出一个可编辑窗口(可以对listview选定的那行进行修改)求代码
1个回答
展开全部
///
///Form1
///
private void button1_Click(object sender, EventArgs e)
{
Form2 frm = new Form2();
int a = listView1.FocusedItem.Index;//获取当前选择项索引
for (int i = 0; i < 5;i++ )
{
frm.str[i] = this.listView1.Items[a].SubItems[i].Text;
}
frm.ShowDialog();
}
///
///Form2
///
public string[] str = new string[5];
public Form2(Form1 frm ;)
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
this.textBox1.Text = str[0];
this.textBox2.Text = str[1];
this.textBox3.Text = str[2];
this.textBox4.Text = str[3];
this.textBox5.Text = str[4];
}
Form2 用来显示 选择项的值 修改后保存
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询