[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

When to use the Refresh method

Posted on 2003-12-08
6
Medium Priority
?
259 Views
Last Modified: 2010-05-01
When does one know when to use the Refresh method of a form or control?  I've seen sample code where it's used quite a bit.  As a test, I've removed them and the application still seems to work fine.

Thanks.
0
Comment
Question by:halfondj
[X]
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
6 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9898556
REfresh is used to forces a complete repaint of a form or control.


If you have do a lot inside the routine and you want to refresh the form or control, then you need to use refresh

ie.

Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Text1.Text = Now
Text1.Refresh
Sleep 3000
End Sub


without the refresh the time will show 3 seconds later
0
 
LVL 5

Expert Comment

by:mccainz2
ID: 9898557
For example ,
I have a flexgrid which can have several 100 to 1000 items loaded into it ...If you have autoredraw=true then the grid will run extremely slow as it is trying to redraw itself every time any modification is made , in my case I am talking around 30 seconds ... If you turn autoredraw=false then the grid doesnt try to redraw itself until you call the refresh method when I am finished with all my updates to the grid...
0
 
LVL 5

Expert Comment

by:mccainz2
ID: 9898632
Arghh, Make that the redraw property rather....My memory played a trick on me , went back to verify and I was remembering redraw rather than refresh
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 9901138
You need to use either Refresh or call DoEvents from within a looping structure that updates visual components during each iteration as VB does not update the screen until all code has completed.  Only do this if immediate feedback is required as it does slow down execution significantly.

Idle_Mind
0
 

Author Comment

by:halfondj
ID: 9903887
After setting the status bar, e.g.

     stbStatusBar.Panels(1).Text = "Ending communications session."

How would one refresh the status bar?  I get compile errors when trying:

    stbStatusBar.Panels(1).Text.Refresh

Thanks.
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 1000 total points
ID: 9903994
Just

stbStatusBar.Refresh
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…
Suggested Courses

656 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