0% found this document useful (0 votes)
19 views2 pages

Codigo Combox

The document describes a form with two list boxes and buttons to move items between the boxes and clear them. Buttons add, remove, clear items from the first box and move selected items between the boxes.

Uploaded by

Erick Hernández
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

Codigo Combox

The document describes a form with two list boxes and buttons to move items between the boxes and clear them. Buttons add, remove, clear items from the first box and move selected items between the boxes.

Uploaded by

Erick Hernández
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

namespace Practica_3_ComboBox

{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)


{
if (!textDato.Text.Equals(""))
{
listBox1.Items.Add(textDato.Text);
textDato.Text = "";
textDato.Focus();
}
}

private void button2_Click(object sender, EventArgs e)


{
if (listBox1.Items.Count > 0)
{
int index = listBox1.SelectedIndex;
listBox1.Items.RemoveAt(index);
}

private void button3_Click(object sender, EventArgs e)


{
listBox1.Items.Clear();
}

private void button4_Click(object sender, EventArgs e)


{
if (listBox1.Items.Count > 0)
{
String aux = listBox1.SelectedItem.ToString();
int index = listBox1.FindString(aux);
listBox1.Items.RemoveAt(index);
listBox2.Items.Add(aux);
}
}

private void button5_Click(object sender, EventArgs e)


{
if (listBox1.Items.Count > 0)
{
String aux = listBox2.SelectedItem.ToString();
int index = listBox2.FindString(aux);
listBox2.Items.RemoveAt(index);
listBox1.Items.Add(aux);
}
}
}
}

You might also like