Groups | Blog | Home
all groups > vb.net controls > october 2004 >

vb.net controls : Sort error on datagrid column name


nate axtell
10/28/2004 7:30:29 AM
In VB .NET I load the contents of an Excel or comma seperated values file
into a dataGrid (via a datatable). One of the columns has a comma in the
name of the column. So for the comma separated values files I put double
quotes are the column name. What I see is that the name ends up getting
displayed correctly in the DataGrid column, "Class (1,2,3)". When I click
on the column to sort I see the following error:
"Addition information: [Class(1 isn't a valid Sort string entry"
Somehow the column name is being broken at the first comma. Is there a way
around this, does anyone know what's happening?

Scott M.
10/28/2004 5:22:43 PM
[quoted text, click to view]

This is happening because commas are special characters. After reading in
the data from the Excel spreadsheet, I would rename the column in the
DataSet (you have the data stored in a DataSet, don't you?) to not include
the commas.

nate axtell
10/29/2004 7:07:04 AM
yeah, its all in a DataSet.DataTable. What I ended up doing was renameing
the columns replacing the commas, but I still keep a reference array of
excel column names in case I need them. Thanks for the suggestion.

[quoted text, click to view]

AddThis Social Bookmark Button