CellBackColor, CellForeColor Properties (ModHFGrid) Example

The following example uses the CellBackColor and CellForeColor properties in ModHFGrid. It resets the background and text colors of the focused cell randomly twice each second for the ModHFGrid. To use this example, paste the following code into the Declarations section of a form with a Timer control and a ModHFGrid with the names Timer1 and ModHFGrid1 respectively and then load the form.

Private Sub Form_Load ()
   Timer1.Interval =500
   ModHFGrid1.Text ="Focus Here"
End Sub

Private Sub Timer1_Timer ()
   ModHFGrid1.CellBackColor =QBColor(Rnd * 15)
   ModHFGrid1.CellForeColor =QBColor(Rnd * 10)
End Sub