我可以在单击按钮时将列表框中的多个选定项目显示到文本框中,但是如何在消息框上显示相同的项目?我的意思是在消息框上显示第一个项目不是问题,但同时显示多个项目是。建议请...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace cities
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Clear();
foreach (object selectedItem in listBox1.SelectedItems)
{
textBox1.AppendText(selectedItem.ToString() + Environment.NewLine);
}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}