Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why does text only show at end of procedure? 1

Status
Not open for further replies.

DickieD

Technical User
Nov 12, 2002
8
0
0
GB
When I execute code in a procedure containing a label which describes the process (copying a file) the text only appears after the file copy has finished. I have tried event handling to no avail. If I stop the code running by putting in a message box the text does appear OK.

[Label2.Text = "Now copying, please wait......"
File.Copy(PatPath & ImagePath, Imagetarget & Imagetag, True)]

The File.Copy is in a For-To-Next loop if that makes any difference.

Any help would be greatly appreciated
 
I do not know how to explain this technically, but the code is its own driving force and does not look around to see whats going on while it is working.

If you want to update a textbox in your loop then add this line of code below the textbox statement.

System.Windows.Forms.Application.DoEvents()

This will make the loop look around to see if it is ignoring something. This will also solve the prolbem of moving your window while the function is working and allowing it to repaint.

Kris
 
krisbrixon

Very many thanks for your assistance, greatly appreciated, the wall I was banging my head against is also relieved!

Kind regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top