Solved

VB.net 2005 - status bar updates

Posted on 2007-03-23
4
709 Views
Last Modified: 2008-01-09
I'm using a status bar that's "supposed" to give an indication of what's going on in some minor-lengthy processing...
Problem is, I don't see 'anything' - none of the text that I'm trying to drop in there before each function is called, until the last one is done (which I've now set to blank).

I tried placing a doevents in the sub, but - same results...
Any idea what I need to do so that this is updated properly?
0
Comment
Question by:sirbounty
  • 2
  • 2
4 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18784297
Can you show us some code from your subs?...
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18784301
Here's the main processing sub...tssStatus is the tool strip...

Private Sub txtShare_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtShare.KeyDown
        If e.KeyCode = Keys.Enter Then
            Dim strShare As String = Nothing
            If txtShare.Text.Substring(0, 2) = "\\" Then 'UNC used
                strShare = txtShare.Text.Trim
            ElseIf IsNumeric(txtShare.Text) Or IsNumeric(txtShare.Text.Substring(1)) Then
                Application.DoEvents() 'tried this...
                tssStatus.Text = "Locating user share..."
                strShare = QueryUser(txtShare.Text)
                tssStatus.Text = "Determining user's email address..."
                txtTo.Text = FindEmail(txtShare.Text)
            Else
                strShare = QueryGroup(txtShare.Text)
                tssStatus.Text = "Locating group share..."
            End If
            Try
                tssStatus.Text = "Determining absolute path..."
                strTarget = FindAbs(strShare)
                tssStatus.Text = "Finding current quota detail..."
                UpdateQuotaDetail()
            Catch ex As Exception
                MessageBox.Show(Err.Description)
            End Try
            tssStatus.Text = "Searching quota adjustment history..."
            ShowHistory()
            tssStatus.Text = ""
        End If
    End Sub
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 250 total points
ID: 18784316
So it looks like you are making some database calls which are usually pretty resource intensive and are often blocking calls.

You need to place the call to DoEvents() immediately AFTER you update tssStatus and BEFORE you make the database calls:

    Private Sub txtShare_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtShare.KeyDown
        If e.KeyCode = Keys.Enter Then
            Dim strShare As String = Nothing
            If txtShare.Text.Substring(0, 2) = "\\" Then 'UNC used
                strShare = txtShare.Text.Trim
            ElseIf IsNumeric(txtShare.Text) Or IsNumeric(txtShare.Text.Substring(1)) Then
                tssStatus.Text = "Locating user share..."
                Application.DoEvents()
                strShare = QueryUser(txtShare.Text)
                tssStatus.Text = "Determining user's email address..."
                Application.DoEvents()
                txtTo.Text = FindEmail(txtShare.Text)
            Else
                strShare = QueryGroup(txtShare.Text)
                tssStatus.Text = "Locating group share..."
                Application.DoEvents()
            End If
            Try
                tssStatus.Text = "Determining absolute path..."
                Application.DoEvents()
                strTarget = FindAbs(strShare)
                tssStatus.Text = "Finding current quota detail..."
                Application.DoEvents()
                UpdateQuotaDetail()
            Catch ex As Exception
                MessageBox.Show(Err.Description)
            End Try
            tssStatus.Text = "Searching quota adjustment history..."
            Application.DoEvents()
            ShowHistory()
            tssStatus.Text = ""
        End If
    End Sub
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18784347
So...the cart was before the horse.
Thanx!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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 …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now