コード例 #1
0
        private void DeleteEmployee1_Load(object sender, EventArgs e)
        {
            TRAVELDB TDB = new TRAVELDB();

            DataTable dt = TDB.comboboxshowempname();

            comboBox1.DataSource    = dt;
            comboBox1.DisplayMember = dt.Columns[1].ToString();
            comboBox1.ValueMember   = dt.Columns[0].ToString();
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            TRAVELDB TDB = new TRAVELDB();

            try
            {
                string name = comboBox1.Text.ToString();
                TDB.deleteemp(name);
                MessageBox.Show("successful delete");
            }
            catch (Exception)
            { MessageBox.Show("Try Again"); }
            DataTable dt = TDB.comboboxshowempname();

            comboBox1.DataSource    = dt;
            comboBox1.DisplayMember = dt.Columns[1].ToString();
            comboBox1.ValueMember   = dt.Columns[0].ToString();
        }