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

Clase ComboBox ListBox

Uploaded by

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

Clase ComboBox ListBox

Uploaded by

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

Clase ComboBox / Listbox

Lic. Juan Gabriel Zelaya A.


Jgzelaya1227@yahoo.com
Gabrielzelaya122776@gmail.com

Cel.9899-2374

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

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
if (comboBox1.SelectedIndex==0)
{
textBox3.Text = Convert.ToString(Convert.ToInt32(textBox1.Text) +
Convert.ToInt32(textBox2.Text));

/* Esta es otra adopción


if (comboBox1.SelectedIndex==0)
{
textBox3.Text = Convert.ToString(Convert.ToInt32(textBox1.Text) +
Convert.ToInt32(textBox2.Text));
}*/

}
}

private void button1_Click(object sender, EventArgs e)


{
listBox1.Items.Add(textBox1.Text);
label1.Text = "Lacantidad de elemtos en listBox1 es: " +
Convert.ToString(listBox1.Items.Count);
textBox1.Text = "";
textBox1.Focus();
}

private void button2_Click(object sender, EventArgs e)


{
listBox1.Items.Clear();
label1.Text = "Lacantidad de elemtos en listBox1 es: " +
Convert.ToString(listBox1.Items.Count);
}
}
}

You might also like