public void Items() { try { ItemRepository itemManager = new ItemRepository(); var list = itemManager.GetAllItems(metroTextBox1.Text); var bindingList = new BindingList <Items>(list); var source = new BindingSource(bindingList, null); dg_item_grid.Columns.Clear(); dg_item_grid.DataSource = source; dg_item_grid.Columns["ID"].Visible = false; dg_item_grid.Columns["CategoryId"].Visible = false; dg_item_grid.Columns["SubCategoryId"].Visible = false; dg_item_grid.Columns["HasSerial"].Visible = false; DataGridViewButtonColumn btn_preview = new DataGridViewButtonColumn(); btn_preview.HeaderText = "#"; btn_preview.Text = "Details"; btn_preview.UseColumnTextForButtonValue = true; dg_item_grid.Columns.Add(btn_preview); DataGridViewButtonColumn btn2 = new DataGridViewButtonColumn(); btn2.HeaderText = "###"; btn2.Text = "Inventory"; btn2.UseColumnTextForButtonValue = true; this.dg_item_grid.Columns.Add(btn2); dg_item_grid.ClearSelection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ItemInformationAutoComplete() { txt_model.AutoCompleteMode = AutoCompleteMode.Suggest; txt_model.AutoCompleteSource = AutoCompleteSource.CustomSource; AutoCompleteStringCollection namec = new AutoCompleteStringCollection(); ItemRepository itemManager = new ItemRepository(); var list = itemManager.GetAllItems(txt_model.Text); if (list.Count > 0) { foreach (var itemlist in list) { namec.Add(itemlist.Model); } } txt_model.AutoCompleteCustomSource = namec; }
public void Items() { try { //Connection connection = new Connection(); Items items = new Items(); ItemRepository itemManager = new ItemRepository(items); var list = itemManager.GetAllItems(metroTextBox1.Text); dataGridView1.Columns.Clear(); dataGridView1.DataSource = list; dataGridView1.Columns[0].Visible = false; dataGridView1.Columns[1].Visible = false; dataGridView1.Columns[2].Visible = false; DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); btn.HeaderText = "#"; btn.Text = "Select"; btn.UseColumnTextForButtonValue = true; dataGridView1.Columns.Add(btn); dataGridView1.ClearSelection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }