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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make grid display current row in distinct color?

Grids

How to make grid display current row in distinct color?

by  ramani  Posted    (Edited  )
**********************************************************
** How to make grid display current row in distinct color?
**********************************************************
** by Subramanian.G (ramani)
** FoxAcc Software
** ramani_g@yahoo.com
**********************************************************

At the form level create a variable,say,[color /blue] inRecNo [color /] and put the initial value as [color /blue] 0 [color /]. Add code as suggested below ..

[color /blue]
MyGrid.InitEvent
****************
DODEFAULT()
WITH THIS
.SetAll("DynamicBackColor", ;
"IIF(recno(This.RecordSource)=ThisForm.inRecno, ;
RGB(0,255,255),RGB(255,255,192))","COLUMN")
ENDWITH
[color /blue]
MyGrid.AfterRowColChangeEvent
*****************************
DODEFAULT()
ThisForm.inRecNo = RECNO()
This.Columns(This.ActiveColumn).Text1.BackColor = RGB(0,255,255)
This.Refresh()
[color /]
**********************************************************
This will make the back color of the row your are editing in the grid.. to SkyBlue. while the rest of the records will have a distinct cream/yellow.
**********************************************************
OR alternative method [color /blue]
**********************************************************
MyGrid.InitEvent
****************
DODEFAULT()
WITH THIS
.SetAll("DynamicBackColor", ;
"IIF(recno(This.RecordSource)=ThisForm.inRecno, ;
RGB(0,255,255),RGB(255,255,192))","COLUMN")
ENDWITH
nColumncount=This.ColumnCount
For I=1 To nColumncount
Objref=Eval('this.columns(i).'+ ;
This.column1.CurrentControl)
Objref.BackColor=RGB(0,255,255)
Objref.SelectedBackColor=RGB(0,255,255)
Objref.SelectedForecolor = RGB(0,0,0)
Endfor
********************************************************* [color /]*********************************************************
** EOF **
** Ramani (Subramanian.G), FoxAcc, ramani_g@yahoo.com
**********************************************************
Evaluate this to make others know how useful is this :)
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top