Solved

VB.net 2005 - status bar updates

Posted on 2007-03-23
4
713 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

776 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