110,534
社区成员
发帖
与我相关
我的任务
分享
List<string> list = new List<string>();
private void Form1_Load(object sender, EventArgs e)
{
//这一段for循环放在你的CheckListBox的数据绑定之后
for (int i = 0; i < checkedListBox1.Items.Count; i++)
{
list.Add(checkedListBox1.Items[i].ToString());
}
}
private int index = -1;
private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (checkedListBox1.SelectedIndex > -1 && checkedListBox1.SelectedIndex != index)
{
if (index > -1)
checkedListBox1.Items[index] = list[index];
index = checkedListBox1.SelectedIndex;
checkedListBox1.Items[checkedListBox1.SelectedIndex] = list[checkedListBox1.SelectedIndex] + " 192.168.0.1";
}
}
private int index = -1;
private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (checkedListBox1.SelectedIndex > -1 && checkedListBox1.SelectedIndex != index)
{
index = checkedListBox1.SelectedIndex;
checkedListBox1.Items[checkedListBox1.SelectedIndex] = checkedListBox1.SelectedItem + " 192.168.0.1";
}
}