Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Problem msflexgrid flickering

Posted on 2013-12-23
3
455 Views
Last Modified: 2013-12-24
I am trying to update a 8 row 10 column msflexgrid, but cannot stop the flicker in the cells
setting the autodraw to false then true helps, but does not stop it completely.
How can this be fixed ?
the code
 Sub ResetBoard() 'reset all the cells back to form load(imgCellBG.Picture)
 Dim r As Integer
    Dim c As Integer
    flexCleo.Redraw = False
    DoEvents
    For c = 0 To 9
    For r = 0 To 7
    With flexCleo
    .Col = c
    .Row = r
   
      .CellForeColor = vbWhite '.CellPicture = imgHitUnSelected.Picture
    Set .CellPicture = imgCellBG.Picture
     
    End With
    Next
    Next
    flexCleo.Redraw = True
 End Sub

Open in new window

0
Comment
Question by:isnoend2001
  • 2
3 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 39738340
Try this. Add the following API declaration at the top of your form

Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long

Open in new window


And then try this
Sub ResetBoard() 'reset all the cells back to form load(imgCellBG.Picture)
 Dim r As Integer
    Dim c As Integer
    'flexCleo.Redraw = False
    LockWindowUpdate flexCleo.hWnd
    DoEvents
    For c = 0 To 9
    For r = 0 To 7
    With flexCleo
    .Col = c
    .Row = r
   
      .CellForeColor = vbWhite '.CellPicture = imgHitUnSelected.Picture
    Set .CellPicture = imgCellBG.Picture
     
    End With
    Next
    Next
    'flexCleo.Redraw = True
    LockWindowUpdate False
 End Sub

Open in new window

0
 

Author Closing Comment

by:isnoend2001
ID: 39738362
Good job
Thanks MartinLiss
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39738371
You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2013
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question