Home All Groups Group Topic Archive Search About

Add columns in Datagrid

Author
1 Jul 2006 10:13 AM
Familjen Karlsson
Hi
I want to add columns in a Datagrid and I want the Columnheaders to show and
empty cells to show without adding any records. For example, sometimes there
aren 't any records in the database, which the datagrid is based on or you
haven't added anything to the columns. How do I do that and how do I add
things to the columns if the Datagrid is not bound to a database or want to
add things not from a database.

Hope you understand what I mean with my questions, have a hard time myself.

Happy for answers

Fia

Author
1 Jul 2006 3:40 PM
Cor Ligthert [MVP]
Fia,

A datagrid, assuming is windows forms is never binded to a database. It is
almost forever binded direct or indirect to a datatable. You can add as much
columns to that as you wish. Be aware that added columns will not be
updated.

I think that in this sample is all you need.

http://www.vb-tips.com/dbPages.aspx?ID=76a81eb8-ea2d-48f4-99c3-a3539697edbd

I hope this helps,

Cor

Show quoteHide quote
"Familjen Karlsson" <fiao***@telia.com> schreef in bericht
news:WUrpg.7022$E02.2168@newsb.telia.net...
> Hi
> I want to add columns in a Datagrid and I want the Columnheaders to show
> and
> empty cells to show without adding any records. For example, sometimes
> there
> aren 't any records in the database, which the datagrid is based on or you
> haven't added anything to the columns. How do I do that and how do I add
> things to the columns if the Datagrid is not bound to a database or want
> to
> add things not from a database.
>
> Hope you understand what I mean with my questions, have a hard time
> myself.
>
> Happy for answers
>
> Fia
>
>
>