English 中文(简体)
数据网格:在顶点添加新的条目
原标题:datagridview: add new entries at the top

Is it possible to add new entries in a datagridview at the top instead at the bottom?

最佳回答

我通过一个国际发展研究中心来解答问题。

问题回答

《数据集》对你的收集工作有约束力,因此,如果你在上层插入,他们就应当显示。 添加新项目:

list.Insert(0, item)

This way worked for me:

dataGridView1.Rows.Insert(0, new string[] {
    "Data1", "Data2", "Data3" // [, "DataN"] ..
});

希望会有所助益。

你们必须处理钥匙。 简单地做jrdk提到并使用所建装置的功能,如:

 First create a new row
Dim tmpRow = New DataGridViewRow

 Dimension or do whatever
tmpRow.Height = _cellRectSize

 Add the row to your DataGridView(i.e dgvEditor) at index 0 for it to be at top
Me.dgvEditor.Rows.Insert(0, tmpRow)

在一些项目中采用了这一准确的法典,并且只做了罚款。 希望能帮助人们走出来!

也可以在中间插入。 这将使你有1,2,3,4,5,6名。

        dataGridView1.Rows.Insert(0, new string[] { "6", "6", "6" });
        dataGridView1.Rows.Insert(0, new string[] { "5", "5", "5" });
        dataGridView1.Rows.Insert(0, new string[] { "4", "4", "4" });

        dataGridView1.Rows.Insert(0, new string[] { "1", "1", "1" });
        dataGridView1.Rows.Insert(1, new string[] { "2", "2", "2" });
        dataGridView1.Rows.Insert(2, new string[] { "3", "3", "3" });




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签