I have a column in a grid related on a numeric field with value zero.
When I open the form, the grid does display the zero and that is NOT
what I want.
What I want is to display blank instead of zero.
What shall I do?
Thank you in advance.
Will that do?
Dan
Thank you all.
I used the following command for the fields which value is zero for
the bound table
BLANK FIELDS fieldName
Thank you for your advice.
I create the columns at runtime. How will you implement your advice ?
Can you give me a code sample ?
Since yours is a display issue, I would suggest to go the
form.grid.column.Format="Z" way instead of manipulating actual content.
hth
-Stefan
>> Add another textbox (not bound to the numeric field) or add a label in
>> column and use DynamicCurrentcontrol to alternate between. If there is a
>> value other than 0, show your bound textbox, otherwise show the label."Sithu" <cithuk...@gmail.com> wrote in message
>>
>>> Hi all,
>>> I have a column in a grid related on a numeric field with value zero.
>>> When I open the form, the grid does display the zero and that is NOT
>>> what I want.
>>> What I want is to display blank instead of zero.
>>> What shall I do?
>>> Thank you in advance.
>
> I create the columns at runtime. How will you implement your advice ?
Create an new class and inherit from base class "Column". This must be done in a
prg, not with a designer. There you set, as others wrote, .Format to "Z". In
your grid, you set .MemberClass and .MemberClassLibrary to the new class and its
file, this you can do in the designer. From now on, the grid creates all columns
based on this class.
DEFINE CLASS MyColumn AS column
Format = "Z"
ENDDEFINE
Another solution:
Create your column class as above.
At runtime after your grid is filled, set .MemberClass and .MemberClassLibrary
to the new class, delete the column with the wrong display behaviour, add an new
column based on your column and set its control source to the respective field.
At the end, reset the .MemberClass properties
theGrid.MemberClass = "MyColumn"
theGrid.MemberClassLibrary = "maybe\path\MyColumns.prg"
FOR i = 1 TO theGrid.ColumnCount
IF upper(theGrid.Columns(i).Controlsource) = "THEFIELD"
theGrid.DeleteColumn(i)
theGrid.AddColumn(i)
theGrid.Columns(theGrid.ColumnCount).ControlSource = "THEFIELD"
EXIT
ENDIF
ENDFOR
theGrid.MemberClass = ""
theGrid.MemberClassLibrary = ""
Attention:
the index in AddColumn tells, where to place the new column visually, but the
new column is added to the end of the internal column list. Therefor you must
reference the new column by theGrid.Columns(theGrid.ColumnCount)
Advantage of this solution: all the other columns have default behaviour, only
the special column has special behaviour.
Disadvantage: you have to maintain column creation everytime you change the
.RecordSource of the grid.
Regards
Bernhard Sander
Thank you for your help,
With Regards,
Sithu