I’m binding a query to a WinForms DataGridView. I want the column headers to have spaces when needed. For example, I would want a column header to be First Name instead of FirstName.
How do you create your own custom column names in LINQ?
For example:
Dim query = From u In db.Users _ Select u.FirstName AS 'First Name'
I solved my own problem but all of your answers were very helpful and pointed me in the right direction.
In my
LINQquery, if a column name had more than one word I would separate the words with an underscore:Then, within the
Paintmethod of theDataGridView, I replaced all underscores within the header with a space: