如何在VB.NET中编辑datagridview的第一列以索引cloumn [英] How to Edit first column of datagridview to index cloumn in VB.NET

查看:349
本文介绍了如何在VB.NET中编辑datagridview的第一列以索引cloumn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VB.NET中有一个datagridview,现在我想将此datagridview的第一列编辑为索引列,该列显示从1到n(n是行数)的行索引.
大家请我帮忙.

预先感谢.

I have a datagridview in VB.NET ,now I want to edit the first column of this datagridview to index column that display index of rows from 1 to n(n is the number of row).

Everyone help me please.

Thanks in advance.

推荐答案

我不确定第一列"的含义.如果它是具有行标题的通常为灰色的列,那么您需要更改每行的行标题文本,然后在其中放置数字.例如:
I''m not sure what you mean by the "first column." If it''s the normally gray column that has the row headers, then you need to change the row header text for each row and put the numbers there. For example:
Me.DataGridView1.Rows.Item(Index).HeaderCell.Value = Index.ToString()



如果您真的是第一列,则将行号放在每一行的第一单元格中.



If you really mean the first column, then put the row number in the first cell on each row.


这篇关于如何在VB.NET中编辑datagridview的第一列以索引cloumn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆