Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling Columns in Grid

Status
Not open for further replies.

jerold

Programmer
Aug 30, 2000
52
PH
I have Grid 1 with 2 columns.

Could you help me setup this condition:

If a column1 contains a value >0, column2 will be disabled.
But if the column1 has a value =0, column2 wil be enabled.
Same thing with column2, if it contains a value >0,
column1 will be disabled.If column2 has a value=0,
column1 will be enabled.

Both columns are enabled by default. If both columns have
no value or value = 0, both are enabled.

Please help on this problem.

Thank you.

 
Hi, Jerold!

The most simple way is putting following line in the WHEN event of the control inside of column:

return NOT (this.Value > 0)

If you want in addition to have control color appear as disabled, use DynamicBackColor/DynamicForeColor properties of column to define expression for color based on values in table using 'iif' function, for example:

Grid1.Column1.DynamicBackColor = "iif(MyTable.MyField > 0, RGB(128,128,128), RGB(255,255,255))"

Above line will show ALL non-zero values in gray background.


Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top