Exemplo n.º 1
0
        private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            DbHandler dbh = new DbHandler();

            dbh.refreshListBox(listBox1, "foodChange", searchResults[listBox2.SelectedIndex]);
            SqlDataReader sdr = dbh.read("select * from Food where id=" + searchResults[listBox2.SelectedIndex]);

            sdr.Read();
            comboBox1.SelectedValue = sdr.GetInt32(1);
            comboBox3.SelectedValue = sdr.GetInt32(3);
        }
Exemplo n.º 2
0
        public DeleteFood()
        {
            InitializeComponent();

            label6.Visible = false;
            DbHandler dbh = new DbHandler();

            dbh.addItemsToComboBox(comboBox3, 0, 1, "HowPrepare", 2);
            dbh.addItemsToComboBox(comboBox1, 0, 1, "MeasurementUnits", -1);
            dbh.addItemsToComboBox(comboBox4, 0, 2, "Food", -1);
            dbh.refreshListBox(listBox1, "foodChange", (int)comboBox4.SelectedValue);
        }