DataGridView Winform Auto Insert Ordinal Column (Trick)

Posted by pang on Stack Overflow See other posts from Stack Overflow or by pang
Published on 2010-03-22T03:24:34Z Indexed on 2010/03/22 3:41 UTC
Read the original article Hit count: 485

Filed under:
|

I want to get some trick for this problem.

I have my table like this

Product (uuid, Name)

and one datagridview to display this information ( dataGridView.DataSouce = Products which is assign on runtime)

  • My problem is that I want to have "No" column on dataGridView which will show like below

    No | Name

    1 | ProdctA

    2 | ProductB

    3 | ProductC

What I do right now is create a "No" field on my product Model, and loop through all the row and assign value to it.

I think this is not a good solution.

Hope anyone can suggest better solution.

Thanks,

© Stack Overflow or respective owner

Related posts about winform

Related posts about datagridview-trick