Share via


Changing a cellback color of a defined msflexgrid cell??

Question

Saturday, May 27, 2006 1:14 PM

Hi everybody,

Think that,  I have a MsFlexgrid control and a Command1 on my form ..

When I click the button  , I want to select a defined cell and give it a color....... I couldn't do it

But I especially want to mention this ,I don't  want to give color to all the cells in grid.. Only for given coordinates of  a cell  ...  example like (4,2)   row 4 and col 2

Below is my test

MSFlexGrid1.CellBackColor = MSFlexGrid1.TextMatrix(4, 2) = vbred

Thanks for all ..

All replies (4)

Friday, June 2, 2006 4:31 AM ✅Answered

Hi,

This method is used only for changing a single cell color, however you can change back color by of multiple cells using loops. try this code..

for i=1 to 3 ' for rows

   for j= 1 to 3 'for cols

      mf1.row=i

      mf1.col=j

      mf1.cellbackcolor=vbred

   next

next

 


Saturday, May 27, 2006 2:20 PM

Hi,

First set the row and col property of flexgrid then change the backcolor property,

 

Check this code

mf1.col=1

mf1.row=1

mf1.cellbackcolor=vbRed

 

Happy Coding

Atanu Maity

 


Saturday, May 27, 2006 3:43 PM

OK Atanu , thanks too much , this worked.. but If I want to select another coordinate of cell or 3 cells ,for the same flexgrid..

With this method, Can I only select 1 cell?

 


Thursday, June 14, 2007 9:24 AM

thanks for the tip...i'm a beginning vba programmer and i'm currently studying about flexgrid for my access project and it was very helpful..i appreciate it...