> > In a grid i have populated a table having fields and data as under:
> >
> > dates Qnty
> > 18.7.2008 10000
> > 19.7.2008 -8000
> > 21.7.2008 9000
> > 22.7.2008 11500
> > 23.7.2008 -1500
> > 24.7.2008 4500
> >
> > Grid1.colum1.controlsource='mytable.dates'
> > grid2.colum2.controlsource='mytable.qnty'
> >
> > I wish to change the backcolor and forecolor should be different
> > where qnty is negative.Both text are readonly and enabled = .f.
> >
> > is it possible.
> >
> >
> > Please help.
> >
> > thanx in advance.
> >
> >
> >
> >
> > *Exchange of $1 Create only $1, But Exchage of one Ideas Makes different two Ideas*
>
> Hi Binod!
>
> The secret (not a secret actually :-) ) there is the Grid's Dynamic Back Color. Copy this into a PRG then Run. Hope this helps.
>
>
> o = Createobject("FrmTest")
> o.Show
> Read Events
> Set Safety Off
>
>
> Define Class FrmTest As Form
> Height = 300
> Width = 200
> AutoCenter = .T.
>
> Add Object GrdRecords As Grid With;
> Height = 200, Width = 150, Left = 30, Top = 20,;
> AllowCellSelection = .F., ScrollBars = 2, DeleteMark = .F.
>
>
> Procedure Init
> This.GrdRecords.RecordSource= 'tbTest'
> Thisform.GrdRecords.SetAll("DynamicBackColor", ;
> "IIF(tbTest.Qty<0, RGB(169,204,157), RGB(255,255,255))", "Column")
> Go Top In('tbTest')
> Endproc
>
> Procedure Load
> Create Table tbTest(Dates d(8), Qty N(10,0))
> Insert Into tbTest(Dates, Qty) ;
> VALUES ({^2008/07/18}, 10000)
> Insert Into tbTest(Dates, Qty) ;
> VALUES ({^2008/07/19}, -8000)
> Insert Into tbTest(Dates, Qty) ;
> VALUES ({^2008/07/21}, 9000)
> Insert Into tbTest(Dates, Qty) ;
> VALUES ({^2008/07/22}, 11500)
> Insert Into tbTest(Dates, Qty) ;
> VALUES ({^2008/07/23}, -1500)
> Insert Into tbTest(Dates, Qty) ;
> VALUES ({^2008/07/24}, 4500)
> Endproc
>
>
> Procedure KeyPress
> Lparameters nKeyCode, nShiftAltCtrl
> If nKeyCode = 27
> Release Thisform
> Endif
>
> Procedure Destroy
> Clear Events
> Endproc
>
>
> Enddefine
>
>
> (coffee)
Thanx Mr Glenn
It worked but only when colums are enabled. But All all colums are enabled=.f..
how ever , I had rectified my codes as the syntex was wrong. I was using
iif(qty > 0,rgb(0,0,0),rgb(255,0,0) which should be within ""
Thanx a Lot.
*Exchange of $1 Create only $1, But Exchage of one Ideas Makes different two Ideas*