Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB.net 2005 - status bar updates

Posted on 2007-03-23
4
Medium Priority
?
732 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 1000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

604 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