//新增
private void btnAddColumn_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(txtColumn.Text.Trim()))
{
MessageBox.Show("不能为空", "信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtColumn.Focus();
txtColumn.SelectAll();
return;
}
lstColumn.Items.Add(txtColumn.Text.Trim());
}
/移除
private void btnDeleteColumn_Click(object sender, EventArgs e)
{
if (lstColumn.SelectedIndex > -1)
lstColumn.Items.Remove(lstColumn.SelectedItem);
}
//清空
private void btnClearColumn_Click(object sender, EventArgs e)
{
if (lstColumn.Items.Count > 0)
lstColumn.Items.Clear();
}
//修改
private void btnColumnChange_Click(object sender, EventArgs e)
{
if (lstColumn.SelectedIndex > -1)
{
lstColumn.Items[lstColumn.SelectedIndex] = txtColumn.Text;
}
}
//listbox选中
private void lstColumn_SelectedIndexChanged(object sender, EventArgs e)
{
if (lstColumn.SelectedIndex > -1)
{
txtColumn.Text = lstColumn.Items[lstColumn.SelectedIndex].ToString();
}
}