private void SetGrid(Bitmap img, string title, int dataGridNumber, string threadID, string url) { if (this.historyDataGrid.InvokeRequired) { SetGridCallback d = new SetGridCallback(SetGrid); this.Invoke(d, new object[] { img, title, dataGridNumber, threadID, url }); } else { historyDataGrid.Rows.Insert(0, img, title, dataGridNumber, threadID, url); } }
private void UpdateGridView(Dictionary <string, Notes> dicNotes) { if (this.dvNotes.InvokeRequired) { SetGridCallback callback = new SetGridCallback(UpdateGridView); this.Invoke(callback, new object[] { dicNotes }); } else { var NotesList = new BindingList <Notes>(dicNotes.Values.ToList()); dvNotes.DataSource = NotesList; dvNotes.Refresh(); } }
private void SetGrid(DataTable dt) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.dgvOrders.InvokeRequired) { SetGridCallback callback = new SetGridCallback(SetGrid); this.Invoke(callback, new object[] { dt }); } else { this.dgvOrders.DataSource = dt; } }
protected void SetGridValue(object[] row, DataGridView grv) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (grv.InvokeRequired) { SetGridCallback d = new SetGridCallback(SetGridValue); this.Invoke(d, new object[] { row, grv }); } else { grv.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(grv)).BeginInit(); grv.Rows.Add(row); ((System.ComponentModel.ISupportInitialize)(grv)).EndInit(); grv.ResumeLayout(false); grv.PerformLayout(); } }
/// <summary> /// Sets the data of the given tree to the grid /// </summary> /// <param name="data">the tree to be shown in the grid</param> public void SetDataForColumns(BinarySearchTree<EventEntry> data) { //sortCol if (grid.Columns.Count == 0) { PureInitColumns(); CreateGrid(); /* foreach (string val in columns.Keys) { bool show = columns[val]; this.checkedListBox1.Items.Add(val, show); } */ this.AddFilter(); } if (this.grid.InvokeRequired) { SetGridCallback d = new SetGridCallback(SetDataForColumns); this.Invoke(d, new object[] { data }); } else { grid.Rows.Clear(); int row = 0; if (data.Count != 0) { foreach (EventEntry ev in data) { this.AddElementToGrid(ev); row++; } } if (grid.SortedColumn != null) this.sortCol = grid.SortedColumn; if (sortCol != null) { grid.Sort(sortCol, lsd); } //no dups if (dupBox.CheckState == CheckState.Unchecked) { RemoveDuplicate(); } } try { grid.CurrentCell = grid.Rows[0].Cells[0]; ; int temp = grid.CurrentCell.RowIndex + 1; this.toolStripStatusLabel1.Text = temp + " of " + grid.RowCount.ToString() + " entries"; } catch (ArgumentOutOfRangeException numberEx) { int temp = 0; this.toolStripStatusLabel1.Text = temp + " of " + grid.RowCount.ToString() + " entries"; } }