Here are the examples of the csharp api class System.Windows.Forms.DataGridViewRowCollection.Insert(int, System.Windows.Forms.DataGridViewRow) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
17 Examples
0
1. Example
View licenseprivate void CopyRow(DataGridView dgv, int source, int destination) { var clone = new DataGridViewRow(); var src = dgv.Rows[source]; clone.CreateCells(dgv); for (int i = 0; i < clone.Cells.Count; i++) { clone.Cells[i].Value = src.Cells[i].Value; } clone.Tag = src.Tag; dgv.Rows.Insert(destination, clone); }
0
2. Example
View licensepublic static bool RowMoveUp(DataGridView dgv, int rowIndex) { if (rowIndex <= 0) return false; var row = dgv.Rows[rowIndex - 1]; dgv.Rows.Remove(row); dgv.Rows.Insert(rowIndex, row); return true; }
0
3. Example
View licensepublic static bool RowMoveDown(DataGridView dgv, int rowIndex) { if (rowIndex >= dgv.Rows.Count - 1) return false; var row = dgv.Rows[rowIndex + 1]; dgv.Rows.Remove(row); dgv.Rows.Insert(rowIndex, row); return true; }
0
4. Example
View licenseprivate void MoveUp(DataGridView dgv, int index) { if (index > 0) { DataGridViewRow row = dgv.Rows[index]; dgv.Rows.RemoveAt(index); dgv.Rows.Insert(index - 1, row); dgv.Rows[index - 1].Selected = true; } }
0
5. Example
View licenseprivate void MoveDown(DataGridView dgv, int index) { int rows = dgv.Rows.Count; if (index < rows - 1) { DataGridViewRow row = dgv.Rows[index]; dgv.Rows.RemoveAt(index); dgv.Rows.Insert(index + 1, row); dgv.Rows[index + 1].Selected = true; } }
0
6. Example
View licenseprivate void PaintOpenPositionGrid(List<Position> positionsAll) { _openPositionGrid.Rows.Clear(); for (int i = 0; i < positionsAll.Count; i++) { if (positionsAll[i].State != PositionStateType.Done) { _openPositionGrid.Rows.Insert(0, GetRow(positionsAll[i])); } } }
0
7. Example
View licenseprivate void PaintClosePositionGrid(List<Position> positionsAll) { _closePositionGrid.Rows.Clear(); for (int i = 0; i < positionsAll.Count; i++) { if (positionsAll[i].State == PositionStateType.Done) { _closePositionGrid.Rows.Insert(0, GetRow(positionsAll[i])); } } }
0
8. Example
View licenseprivate static void SetNewErrorMessage(LogMessage message) { if (!MainWindow.GetDispatcher.CheckAccess()) { MainWindow.GetDispatcher.Invoke(new Action<LogMessage>(SetNewErrorMessage), message); return; } DataGridViewRow row = new DataGridViewRow(); row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[0].Value = DateTime.Now; row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[1].Value = LogMessageType.Error; row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[2].Value = message.Message; _gridErrorLog.Rows.Insert(0, row); if (_logErrorUi == null) { _logErrorUi = new LogErrorUi(_gridErrorLog); _logErrorUi.Closing += _logErrorUi_Closing; _logErrorUi.Show(); } SystemSounds.Beep.Play(); }
0
9. Example
View licenseprivate void ReloadSecuritiesOnTable() { _grid.Rows.Clear(); List<string> names = _set.SecuritiesNames; for (int i = 0;names != null && i < names.Count; i++) { DataGridViewRow row = new DataGridViewRow(); row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[0].Value = names[i]; _grid.Rows.Insert(0, row); } }
0
10. Example
View licenseprivate void PaintMessage(LogMessage messageLog) { try { if (_grid.InvokeRequired) { _grid.Invoke(new Action<LogMessage>(PaintMessage), messageLog); return; } if (_messageses == null) { _messageses = new List<LogMessage>(); } _messageses.Add(messageLog); _messageSender.AddNewMessage(messageLog); DataGridViewRow row = new DataGridViewRow(); row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[0].Value = messageLog.Time; row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[1].Value = messageLog.Type; row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[2].Value = messageLog.Message; _grid.Rows.Insert(0, row); } catch (Exception) { // ignore } }
0
11. Example
View licenseprivate void PaintTableTabsIndex() { if (_gridTableTabsSimple.InvokeRequired) /n ..... /n //View Source file for more details /n }
0
12. Example
View licenseprotected void onSortableDragDrop(object sender, DragEventArgs e) { Point point = this.PointToClient(new Point(e.X, e.Y)); ddSort.to = this.HitTest(point.X, point.Y).RowIndex; if(e.Effect != DragDropEffects.Move || ddSort.to == -1 || Rows.Count < 1 || Rows[ddSort.to].IsNewRow) { return; } e.Effect = DragDropEffects.None; this.Rows.RemoveAt(ddSort.from); this.Rows.Insert(ddSort.to, (DataGridViewRow)e.Data.GetData(typeof(DataGridViewRow))); this.ClearSelection(); this.Rows[ddSort.to].Selected = true; DragDropSortedRow(this, new MovingRowArgs() { Data = ddSort }); }
0
13. Example
View licensepublic static void ThrowAlert(Stream stream, string botName, string message) { if (!TextBoxFromStaThread.Dispatcher.CheckAccess()) { TextBoxFromStaThread.Dispatcher.Invoke( new Action<Stream, string, string>(ThrowAlert), stream, botName, message); return; } if (_grid == null) {// ???? ???? ??????? ?? ???????, ???????? ????? ?? ???????? CreateGrid(); } // ????????? ????? ?????? DataGridViewRow row = new DataGridViewRow(); row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[0].Value = DateTime.Now.ToLongTimeString(); row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[1].Value = botName; row.Cells.Add(new DataGridViewTextBoxCell()); row.Cells[2].Value = message; _grid.Rows.Insert(0, row); // ???????? ?????? if (stream != null) { SoundPlayer player = new SoundPlayer(stream); player.Play(); } if (_ui == null) {// ???? ???? ???? ?? ????? ??? ??????? ?????? ??????? ??? _ui = new AlertMessageFullUi(_grid); _ui.Show(); _ui.Closed += _ui_Closed; } }
0
14. Example
View licenseprivate void PaintPosition(Position position) { try { /n ..... /n //View Source file for more details /n }
0
15. Example
View licenseprivate void PaintTableTabsSimple() { if (_gridTableTabsSimple.InvokeRequired) /n ..... /n //View Source file for more details /n }
0
16. Example
View license[System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute] public voi/n ..... /n //View Source file for more details /n }
0
17. Example
View licensepublic void ShowFileHashForm(string[] paths) { if(!fCancellationPending) { /n ..... /n //View Source file for more details /n }