We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Clearing reverse color on a selected row in MSFlexgrid

jgarner43 asked
Medium Priority
Last Modified: 2010-04-07
I cannot find a method for clearing the reverse colorization in a msflexgrid on a row that has been selected whenever I want to clear the grid.  I display information in the grid, click the desired row and transfer the information on the row to text boxes for editing.  When completed and the information is saved, I want to use the MSFLEXGRID.CLEAR statement.  This works fine but the last selected row continues to be displayed with the reversed color.  I want the entire row, not just a cell, set back to VBWHITE.

Any ideas?
Watch Question

Clear the selection first?


How!  I have not seen any methd for clearing a row or setting all cells in a row.
if u want to set or reset a content in a cell then u can use the following snippet.

To Reset the cells in a Row

For i = 0 to MSFlexGrid1.Cols - 1
    MSFlexGrid1.TextMatrix(.Row,i) = ""
Next i

To Set the cells in a Row

MSFlexGrid1.TextMatrix(.Row,0) = TextBox1.Text
MSFlexGrid1.TextMatrix(.Row,1 = TextBox2Text
and so on....
When You use the MSFLEXGRID.CLEAR statement the backcolor of the cell automatically sets to the default cell backcolor but if it doesn't works for you, try out the following Code

Private Sub Command1_Click()
Dim totalRows
totalRows = MSFlexGrid1.Rows
    For j = 1 To totalRows
        For i = 1 To MSFlexGrid1.Cols - 1
            MSFlexGrid1.Col = i
            MSFlexGrid1.CellBackColor = vbWhite
End Sub


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.