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

Here are the examples of the csharp api class System.Windows.Forms.DataGridViewRowCollection.Insert(int, int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4 Examples 7

1. Example

Project: XmlNotepad
Source File: FormSchemas.cs
View license
public void InsertRow(int i, DataGridViewRow row) {
            this.view.Rows.Insert(i, row);
            if (row.Tag != null) {
                AttachItem(row, row.Tag as SchemaItem);
            }
        }

2. Example

Project: Analysis-Services
Source File: TreeGridView.cs
View license
internal protected virtual void SiteNode(TreeGridNode node, int index)
		{
			if (index < base.Rows.Count)
			{
				base.Rows.Insert(index, node);
			}
			else
			{
				// for the last item.
				base.Rows.Add(node);
			}
		}

3. Example

Project: BismNormalizer
Source File: TreeGridView.cs
View license
internal protected virtual void SiteNode(TreeGridNode node, int index)
		{
			if (index < base.Rows.Count)
			{
				base.Rows.Insert(index, node);
			}
			else
			{
				// for the last item.
				base.Rows.Add(node);
			}
		}

4. Example

Project: CodeContracts
Source File: MainForm.cs
View license
static private void InsertOrUpdate(DataGridView grid, int Id, string[] row)
    {
      Contract.Requires(grid != null);

      int index = 0;
      if (TryFindProcInRows(grid, Id.ToString(), out index))
      {
        var rowIsSelected = grid.CurrentRow.Index == index;
        grid.Rows.RemoveAt(index);
        grid.Rows.Insert(index, row);

        if (rowIsSelected)
        {
          // TODO: how do we set a row?
        }
      }
      else
      {
        grid.Rows.Insert(0, row);
      }
    }