Solved

Problem msflexgrid flickering

Posted on 2013-12-23
3
434 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now