public AddMaterialForm() { InitializeComponent(); connection.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=N:\Receiving and current inventory\Inventory.mdb; Persist Security Info=False;"; mDatabaseController = new DatabaseController(); List <MaterialTable> mats = mDatabaseController.GetMaterial(); FillCombo(mats); }
private void fillMaterialComboBox() { materialcmb.Items.Clear(); DatabaseController dc = new DatabaseController(); materials = dc.GetMaterial(); for (int i = 0; i < materials.Count; i++) { materialcmb.Items.Add(materials[i].material_type); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { List <MaterialTable> mats = mDatabaseController.GetMaterial(); for (int i = 0; i < mats.Count; i++) { if (mats[i].material_type == comboBox1.Text) { TextWidth.Text = mats[i].width; TextHeight.Text = mats[i].height; } } removebutton.Enabled = true; }
private void addbtn_Click(object sender, EventArgs e) { string type = comboBox1.Text; string width = TextWidth.Text; string height = TextHeight.Text; mDatabaseController = new DatabaseController(); List <MaterialTable> mats = mDatabaseController.GetMaterial(); for (int i = 0; i < mats.Count; i++) { if (mats[i].material_type.ToLower() == type.ToLower()) { MessageBox.Show("The database already contains '" + type + "' and blocked the duplicate entry.", "Duplicate Object Blocked"); return; } } Submit(type, width, height); this.Close(); }