System.Windows.Forms.DataGridViewRowCollection.Insert(int, System.Windows.Forms.DataGridViewRow)

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 7

1. Example

View license
private 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);
		}

2. Example

Project: ElectronicObserver
Source File: ControlHelper.cs
View license
public 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;
		}

3. Example

Project: ElectronicObserver
Source File: ControlHelper.cs
View license
public 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;
		}

4. Example

Project: pgina
Source File: ConfigurationUI.cs
View license
private 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;
            }
        }

5. Example

Project: pgina
Source File: ConfigurationUI.cs
View license
private 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;
            }
        }

6. Example

Project: OsEngine
Source File: JournalUi.xaml.cs
View license
private 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]));
                }
            }
        }

7. Example

Project: OsEngine
Source File: JournalUi.xaml.cs
View license
private 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]));
                }
            }
        }

8. Example

Project: OsEngine
Source File: Log.cs
View license
private 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();
        }

9. Example

Project: OsEngine
Source File: OsDataSetUi.xaml.cs
View license
private 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);
            }
        }

10. Example

Project: OsEngine
Source File: Log.cs
View license
private 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
            }
        }

11. Example

Project: OsEngine
Source File: OptimizerUi.xaml.cs
View license
private void PaintTableTabsIndex()
        {
            if (_gridTableTabsSimple.InvokeRequired)
  /n ..... /n //View Source file for more details /n }

12. Example

View license
protected 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 });
        }

13. Example

Project: OsEngine
Source File: AlertMessageManager.cs
View license
public 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;
            }
        }

14. Example

Project: OsEngine
Source File: PositionController.cs
View license
private void PaintPosition(Position position)
        {
            try
            {
              /n ..... /n //View Source file for more details /n }

15. Example

Project: OsEngine
Source File: OptimizerUi.xaml.cs
View license
private void PaintTableTabsSimple()
        {
            if (_gridTableTabsSimple.InvokeRequired)
 /n ..... /n //View Source file for more details /n }

16. Example

Project: OsEngine
Source File: GlobalPosition.cs
View license
[System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute]
        public voi/n ..... /n //View Source file for more details /n }

17. Example

Project: QTTabBar
Source File: FileHashComputerForm.cs
View license
public void ShowFileHashForm(string[] paths) {
            if(!fCancellationPending) {
             /n ..... /n //View Source file for more details /n }