Re: DataGridView can't put spaces in column header when using Datasource property ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Oh i worked it out.

You have to set the 'DataPropertyName' property of the datagridview
column(s), to the name of the public property that exists in the collection
that you set the 'Datasource' property of the datadridview to.

Umm.. did that make sense? lol

Jack.

"Jack" <someone@xxxxxxxxxxxxx> wrote in message
news:ZaadnVF4btxbcNzXnZ2dnUVZ_tWdnZ2d@xxxxxxxxxxxxxxxxxx
Hello,

How do i make the datadridview column header text have a space in them?

I insert a list of items into the datagridview's datasource property which
comes from a database table. It obviously gets the column header text from
the field name in the database; the database field name is 'MobilePhone'
but
i want the column to display 'Mobile Phone'. I would like the column
headers
to have spaces in them to make it look nice to the user.

I tried inserting columns at design time, and matched the names, but what
happens is that i get the columns i set at design time appear, AND the
columns that appear when i set the list to the datasource property. this
means i have double the set of columns.

I set the AutoGenerateColumns to false. Now i only have my design-time
defined columns which is good, but the actual data doesn't display in the
cells ?!?

How can i do this? (Maybe there is some attribute?)

Jack.






.



Relevant Pages

  • DataGridView cant put spaces in column header when using Datasource property ?
    ... How do i make the datadridview column header text have a space in them? ... comes from a database table. ... I tried inserting columns at design time, and matched the names, but what ... columns that appear when i set the list to the datasource property. ...
    (microsoft.public.dotnet.languages.csharp)
  • DataGridView cant put spaces in column header when using Datasource property ?
    ... How do i make the datadridview column header text have a space in them? ... comes from a database table. ... I tried inserting columns at design time, and matched the names, but what ... columns that appear when i set the list to the datasource property. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: DataGridView cant put spaces in column header when using Datasource property ?
    ... How do i make the datadridview column header text have a space in them? ... comes from a database table. ... I tried inserting columns at design time, and matched the names, but what ... columns that appear when i set the list to the datasource property. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Sql injecting
    ... MS has a net group and a database ... // the Northwind type is a subclass of DataContext created by SQLMetal ... // use 'var' keyword because there is no name for the resultant type of the projection ... even if we can't name the type at design time ...
    (comp.databases.ms-sqlserver)
  • Re: Access 2010. New, Improved, and Gone
    ... implement this in code at design time. ... security should be at the lowest level and that's usually the database ... the rest can rely on the relatively meager encryption of the database ... The lowest level is the data itself. ...
    (comp.databases.ms-access)