Hello !
In my app, I create columns in an empty grid depending on SQL definition of the queried fields
I.e char or varchar => textcolumn, numeric (int, float,...)=> Numbercolumn, etc.
GridResultat.Columns.Add(TNxNumberColumn,DC_Query.Fields.SqlName[j] );
=> the header caption is correctly set with Fields.SqlName
I've found a bug in my app for Numbercolumn when trying to set cell content for a SQL null :
if DC_Query.Fields.IsNull[j] then GridResultat.Cell[j,i].AsString:='<null>'
=>
'<null>' is not a correct float value
Several topics in the forum refer to HideWhenEmpty and EmptyCaption properties, but I'm not able to access them in runtime
TNxNumberColumn(GridRequete.ColumnByName[DC_Query.Fields.SqlName[j]]).HideWhenEmpty:=true;
or
(GridRequete.ColumnByName[DC_Query.Fields.SqlName[j]] as TNxNumberColumn).Header.Caption // in a MessageBox
both fire an access violation
What is the correct syntax to proceed?
Thx