[solved] Listbox not updating until end of subs
Posted
#1
(In Topic #715)
Enthusiast

I am using this section of code to wait a seconds for the appliation to start up before begining to do anything but for some reason the
listbox i have on screen is not updated until the end of the fucntions even with me adding in
fmain.ListBox1.Refresh
fmain.Refresh
even the Label1.Text = "Loading System Settings…" is not working
am I doing this correctly or is there something else i need to do to get the app to update my list box so I know what it is doing.
Code
' Gambas class file
Public hConsoleTimer As Timer
Public Sub Form_Open()
hConsoleTimer = New Timer As "MyTimer"
hConsoleTimer.Delay = 1000
hConsoleTimer.Enabled = True
End
Public Sub MyTimer_Timer()
hConsoleTimer.Stop
hConsoleTimer.Enabled = False
Label1.Text = "Loading System Settings..."
Startup.LoadSystemFiles
Label1.Text = "Main Server Address :" & Global.ServerDatabaseLocation & " Database Name : " & Global.ServerDatabaseDatabaseName
Label1.Refresh
Global.AddToListBox("Checking for Connection to Main Database server")
DatabaseFunctions.CheckForDatabaseConnection
End
Posted
Guru

Wait
After setting label text
Code (gambas)
- Label1.text = "SOME TEXT"
- More code...
Or
Wait 0.1
Posted
Guru

Timer default is 1000 so that code is not needed.
Also
Timer.Stop and Timer.Enabled = False is the same thing so you can lose one of those lines
Posted
Guru

Code (gambas)
- BuildForm
- Timer1.Stop
- Label1.Text = "Main Server Ready and waiting.."
- .Height = 400
- .Width = 500
- .Padding = 5
- .Arrangement = Arrange.Vertical
- .Center
- .H = 56
- .W = 100
- .Text = "Loading System Settings...2 Second delay"
- .Background = Color.Yellow
- .Alignment = Align.Center
- .Delay = 2000
Posted
Enthusiast

BruceSteers said
Have you tried using…
Wait
After setting label textCode (gambas)
Label1.text = "SOME TEXT" More code...
Or
Wait 0.1
Thank-you BruceSteers that worked prefectly
Sorry for the delay in Replaying I was not getting any Emails to say you had posted.
What does the wait 0.1 function do?
Posted
Guru

AndyGable said
BruceSteers said
Have you tried using…
Wait
After setting label textCode (gambas)
Label1.text = "SOME TEXT" More code...
Or
Wait 0.1
Thank-you BruceSteers that worked prefectly
Sorry for the delay in Replaying I was not getting any Emails to say you had posted.
What does the wait 0.1 function do?
Waits a tenth of a second.
Sometimes just Wait is not enough.
Wait is supposed to allow events waiting to be processed to finish but I think some things dont wait , or wait continues as soon as a slot is free, so specifying a fraction of a second can do the job while other things catch up.
You're welcome. I tackled the same issue yesterday so was fresh in my mind.
1 guest and 0 members have just viewed this.



