public ItemForm() { InitializeComponent(); dbContext = new LogisticAppDAL.LogisticDbContext(); Refresh(); // ConfigureGrid(); dataGridView1.Anchor = (AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom); var category = dbContext.Item_Categories.ToList <Item_Category>(); if (category.Count() != 0) { Category_txt.DataSource = category; Category_txt.ValueMember = "IC_ID"; Category_txt.DisplayMember = "Name"; } else { MessageBox.Show("Please Fill Item Category First"); this.Close(); } DataGridViewButtonColumn col = new DataGridViewButtonColumn(); col.UseColumnTextForButtonValue = true; col.Text = "Delete"; col.Name = "Delete"; dataGridView1.Columns.Add(col); dataGridView1.CellClick += new DataGridViewCellEventHandler(dataGridView1_CellContentClick); }
public ItemCategoryForm() { InitializeComponent(); dbContext = new LogisticAppDAL.LogisticDbContext(); Refresh(); DataGridViewButtonColumn col = new DataGridViewButtonColumn(); col.UseColumnTextForButtonValue = true; col.Text = "Delete"; col.Name = "Delete"; dataGridView1.Columns.Add(col); dataGridView1.CellClick += new DataGridViewCellEventHandler(dataGridView1_CellContentClick); dataGridView1.Anchor = (AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom); }