Solved

Processing Please Wait Form: While  routine is running

Posted on 2007-04-10
10
429 Views
Last Modified: 2011-09-20
vb.net 2003

What I have:

I have a form called
frmWait

Label called  lblMessage

What I need:
While I'am running routines in my code. I want to be able to call this form. display it. Sort of like a progress bar. Saying..."Processing please wait" ....
and a bonus having  the dots go back and forth ....    ...   .    .... ..   .   etc  
When the routine is done:
frmWait  closes.

Thanks
fordraiders



0
Comment
Question by:fordraiders
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 21

Accepted Solution

by:
theGhost_k8 earned 250 total points
ID: 18885383
in your process
dim obj as frmwait = new frmwait
obj.showdialog


on form_load
1) you can place a GIF for ... on a label
2) manually use timer control to handle number of dots..
 eg. for timers each tick you can add a "." in lable's text.. and check if its crossing some prespecified number of dots!!
eg this will show 20 dots and start from 0 again...
                  if lblDots.text.length < 20
                           lblDots.text = lblDots.text & "."
                   else
                           lblDots.text = "."
                    end if
       
finally when ur process ends you just close the form
0
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 18885710
As theGhost menitioned, an animated GIF on a label sounds like it would fit your needs admirably.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18886012
The success of this really depends on ~WHAT~ the "running routines" are doing.  You may have to move that code to another thread...

Can you give us more details?
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 24

Expert Comment

by:Jeff Certain
ID: 18886036
Mike,

You big sissy. He doesn't _have_ to use multi-threading. :P

Now, whether he _should_ or not is another story entirely.

However, I figured if he was throwing up a "wait" form, there was probably a bunch of processing going on that the user needs to wait on... (I know, I know... assumptions....)

Jeff
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18886068
Lol@Jeff...   ;)

I thought I had seen posts before where making callls to databases and what not have made animated GIFs stop animating...would have to check on that.  Blocking database calls would also stop the Form from processing Timer tick events as well.

If he just has some intensive loops then we can just throw Application.DoEvents() in there and "call it good".

Like I said, it just depends on what you're doing...but I never said anything was wrong with the previous posts!  =)
0
 
LVL 3

Author Comment

by:fordraiders
ID: 18887427
example loop:
looping through  10,000 records ....
 
Private Sub SnR()
              ' Using Access Database Search and Replace
        Dim conn As System.Data.OleDb.OleDbConnection
        Dim tblCriteria As New DataTable
        Dim tblData As New DataTable

        conn = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DM\Sku.mdb")
        'make dataadapters
        Dim dac As New System.Data.OleDb.OleDbDataAdapter("SELECT fldCid, fldFindMe, fldReplaceWith FROM tblCriteria", conn)
        Dim dad As New System.Data.OleDb.OleDbDataAdapter("SELECT fldID, fldDid, fldMfgname, fldMfrnum, fldDescription FROM tblData", conn)
        Dim cb As New System.Data.OleDb.OleDbCommandBuilder(dad)
        'get the datables from Access
        dac.Fill(tblCriteria)
        dad.Fill(tblData)
        'revise the data
        Me.Label18.Text = "Step 5 of 8 :Replacing Words"
        Me.Label18.Refresh()
        'send updated table back to Access
        For Each drc As DataRow In tblCriteria.Rows
            For Each drd As DataRow In tblData.Rows
                drd("fldDescription") = ReplaceWords(drd("fldDescription"), drc("fldFindMe"), drc("fldReplaceWith")) '<------- your procedure
            Next
        Next
        dad.Update(tblData)
         End Sub

to all
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 250 total points
ID: 18887534
Place "Application.DoEvents()" into your tight loop so you can update the label and allow it to repaint itself.

Using the approach presented by theGhost_k8:

        Dim fw As New frmWait
        fw.Show()
        Application.DoEvents()
        For Each drc As DataRow In tblCriteria.Rows
            For Each drd As DataRow In tblData.Rows
                drd("fldDescription") = ReplaceWords(drd("fldDescription"), drc("fldFindMe"), drc("fldReplaceWith"))
                If fw.lblMessage.Text.Length < 20 Then
                    fw.lblMessage.Text = fw.lblMessage.Text & "."
                Else
                    fw.lblMessage.Text = "."
                End if
                Application.DoEvents()
            Next
        Next
        fw.Close()
0
 
LVL 3

Author Comment

by:fordraiders
ID: 18898261
To All,   from
Ghost KB
1) you can place a GIF for ... on a label
2) manually use timer control to handle number of dots..
??  How to do this or example...
0
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 18898287
0
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 18903438
thnx 4 pts, but its not "Ghost KB"
its theGhost<UNDERSCORE>k8.
             ;)
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb.net checkbox 7 47
How to sort a list of objects using an item in an enclosed list 5 47
cannot connect to sqlserver 8 30
Help with adding DLL file in Windows project 20 32
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 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