private void SubmitBtn_Click(object sender, EventArgs e) { var rowindex = Table_Messages.CurrentCell.RowIndex; var IDTable = Table_Messages.Rows[rowindex].Cells[4].Value.ToString(); try { CnC_DatabaseDataContext DataBase = new CnC_DatabaseDataContext(); var DeleteData = (from rows in DataBase.CaseMessages where rows.ID == Int32.Parse(IDTable) select rows).FirstOrDefault(); DataBase.CaseMessages.DeleteOnSubmit(DeleteData); DataBase.SubmitChanges(); var Data = from rows in DataBase.CaseMessages select rows; Table_Messages.DataSource = Data; Table_Messages.AutoResizeRows(); Table_Messages.AutoResizeColumns(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void DeleteMessages_Load(object sender, EventArgs e) { CnC_DatabaseDataContext DataBase = new CnC_DatabaseDataContext(); var Data = from rows in DataBase.CaseMessages select rows; Table_Messages.DataSource = Data; Table_Messages.AutoResizeRows(); Table_Messages.AutoResizeColumns(); }
private void ListClients_Load(object sender, EventArgs e) { CnC_DatabaseDataContext DataBase = new CnC_DatabaseDataContext(); var StreamingIps = (from rows in DataBase.Streaming_IPs select rows); Table_Messages.DataSource = StreamingIps; Table_Messages.AutoResizeRows(); Table_Messages.AutoResizeColumns(); if (Int32.Parse(Which_Form_Private) == 1) { DeleteIP.Visible = true; } if (Int32.Parse(Which_Form_Private) == 0) { DeleteIP.Visible = false; } }
private void Table_Messages_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { Table_Messages.AutoResizeRows(); Table_Messages.AutoResizeColumns(); }