Solved

VB.net 2005 - status bar updates

Posted on 2007-03-23
4
716 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 86

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 86

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

717 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