Solved

Display problems in Status strip

Posted on 2011-09-13
3
385 Views
Last Modified: 2012-06-27
I want the status strip to change when certain commands are being executed in the button click event. I only see the "Status: Change Complete..." notice and not the other ones before that.

any ideas why?
Private Sub btnSet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSet.Click
        Try
            Me.Enabled = True
            ValidateInformation()
            Me.CommandReceived.Text = "Status: Validating Changes....."
            Send_Struct()
            Me.Cursor = Cursors.WaitCursor
            System.Threading.Thread.Sleep(500)
            serialCOMDiscover.Write(Door_Message1)
            Me.CommandReceived.Text = "Status: Sending Changes 1 of 5....."
            System.Threading.Thread.Sleep(500)
            serialCOMDiscover.Write(Door_Message2)
            System.Threading.Thread.Sleep(500)
            Me.CommandReceived.Text = "Status: Sending Changes 2 of 5....."
            serialCOMDiscover.Write(Door_Message3)
            System.Threading.Thread.Sleep(500)
            Me.CommandReceived.Text = "Status: Sending Changes 3 of 5....."
            serialCOMDiscover.Write(Door_Message4)
            System.Threading.Thread.Sleep(500)
            Me.CommandReceived.Text = "Status: Sending Changes 4 of 5....."
            serialCOMDiscover.Write(Door_Message5)
            System.Threading.Thread.Sleep(500)
            Me.CommandReceived.Text = "Status: Sending Changes 5 of 5....."
            Me.Cursor = Cursors.Arrow
            Me.CommandReceived.Text = "Status: Changes Complete....."
            Me.Enabled = True
        Catch ex As Exception
            Me.CommandReceived.Text = "Parameters could not be sent. Please check Device"
        End Try
    End Sub

Open in new window

0
Comment
Question by:cmdolcet
  • 2
3 Comments
 
LVL 40
ID: 36529425
Try Application.DoEvents instead of Sleep. This completes the writing of the Text to the control before going to the following line. Sleep simply stops everything.
0
 

Author Comment

by:cmdolcet
ID: 36529450
Can I see an example of this?
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 125 total points
ID: 36529657
...
Me.CommandReceived.Text = "Status: Sending Changes 1 of 5....."
Application.DoEvents()
serialCOMDiscover.Write(Door_Message2)
...

Open in new window

0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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