J
John Wright
I have a long process I run that needs to be complete before the user can continue. I can change the cursor to an hourglass, but I want to update the Status Strip on the bottom during the process. I set the statusstrip label to "Downloading...", but it will not show up on the form. I need to display this message before it starts the process. I can put a thread.sleep for 1 second after I do the initial process, but that seems sloppy to me. Any suggestions? Here is my code launched from a button click:
'update the label--This does not show because the process starts before the UI updates
slDBList.Text = "Retrieving Databases..."TryMe.Cursor = Cursors.WaitCursorDim lstServers As List(Of String)'set to false in case of an error boolServersLoaded = FalseboolDBLoaded = False'clear the servers list cbServers.DataSource = Nothing'clear the databases list dbDatabases.DataSource = NothingIf chkSort.Checked = True ThenlstServers = GetSqlServers(True)ElselstServers = GetSqlServers(False)End IfcbServers.DataSource = lstServers'set to true to enabled the selected index change on the dropdown boolServersLoaded = TrueslDBList.Text = ""Catch ex As ExceptionMessageBox.Show("Error loading server list. Error: " & ex.ToString, "Data Error", MessageBoxButtons.OK, MessageBoxIcon.Error)boolServersLoaded = FalseslDBList.Text = ""FinallyMe.Cursor = Cursors.ArrowEnd Try
'update the label--This does not show because the process starts before the UI updates
slDBList.Text = "Retrieving Databases..."TryMe.Cursor = Cursors.WaitCursorDim lstServers As List(Of String)'set to false in case of an error boolServersLoaded = FalseboolDBLoaded = False'clear the servers list cbServers.DataSource = Nothing'clear the databases list dbDatabases.DataSource = NothingIf chkSort.Checked = True ThenlstServers = GetSqlServers(True)ElselstServers = GetSqlServers(False)End IfcbServers.DataSource = lstServers'set to true to enabled the selected index change on the dropdown boolServersLoaded = TrueslDBList.Text = ""Catch ex As ExceptionMessageBox.Show("Error loading server list. Error: " & ex.ToString, "Data Error", MessageBoxButtons.OK, MessageBoxIcon.Error)boolServersLoaded = FalseslDBList.Text = ""FinallyMe.Cursor = Cursors.ArrowEnd Try