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 Test
{
public partial class ListBox02 : Form
{
public ListBox02()
{
InitializeComponent();
}
private void ListBox03_Load(object
sender, EventArgs e)
{
//동적 항목 추가
for (int i = 1; i < 10; i++)
{
comboBox1.Items.Add((i * i).ToString());
comboBox2.Items.Add((i * i).ToString());
comboBox3.Items.Add((i * i).ToString());
}
}
private void button1_Click(object
sender, EventArgs e)
{
//comboBox1.SelectedIndex
//comboBox1.SelectedItem
//선택된 항목과 관련된 처리
if
(comboBox1.SelectedIndex > -1)
{
MessageBox.Show(comboBox1.SelectedIndex
+ " : " + comboBox1.SelectedItem);
}
}
private void button2_Click(object
sender, EventArgs e)
{
//항목 <> 기입한 값
MessageBox.Show(comboBox1.Text);
}
private void button3_Click(object
sender, EventArgs e)
{
this.comboBox1.Items.RemoveAt(this.comboBox1.SelectedIndex);
}
}
}