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
Solved

VB.net 2005 - status bar updates

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
How to sort a list of objects using an item in an enclosed list 5 50
VB.net Move a class from Solution Items to a project 2 33
MailAddress in vb 4 29
Code enhancement 4 22
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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

837 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