Solved

OLEAdapter Fill  ISALIVE

Posted on 2004-09-16
16
368 Views
Last Modified: 2012-08-13
Is there something out there that would work for

an OLDBAdapter.Fill



do while FillThread.IsAlive
     ProgressBar.Value += 1
     If ProgressBar.Value = 100 then ProgressBar.Value = 0
loop
0
Comment
Question by:malanois
  • 8
  • 6
  • 2
16 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12076831
What are you trying to accomplish here?

Bob
0
 

Author Comment

by:malanois
ID: 12076864
I am trying to show the status of a search

i am using a ProgressBar to accomplish


        ' Set the SelectCommand to the newly constructed query
        Me.OleDbSelectCommand1.CommandText = cmdText

        'Execute the query
        DbDataSet.Clear()
        'ProgressBar1.Step = 1
        'Do While ????????.IsAlive()
        'ProgressBar1.Value += 1
        'If ProgressBar1.Value = 100 Then ProgressBar1.Value = 0
        ' Loop

        Me.OleDbDataAdapter1.Fill(Me.DbDataSet)


I need to show the status of the Fill
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12076971
That would be making the assumption that the Fill method uses threading which cannot be shown anywhere within the framework for the OleDbDataAdapter.Fill method.  You would need to be able to dig through and find the thread ID to retrieve a reference to it, which is definitely not a trivial task, even if the thread existed.  I don't think that you are going to be able to do it this way.

Bob
0
 

Author Comment

by:malanois
ID: 12077025
What would be some options?

I need to show some type of status for the search.

Thank YOU
MJ
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 12077126
One option would be to use a timer with some animation that gets enabled before the Fill method, and disabled after the Fill completes.  Another option would be to use an animated GIF file in a PictureBox control, and show it before the Fill and hide it after.

Bob
0
 

Author Comment

by:malanois
ID: 12077336

It will not show the image???

what would be wrong??      

 DbDataSet.Clear()
        showimage()
        Me.OleDbDataAdapter1.Fill(Me.DbDataSet)
        hideimage()

    End Sub
    Public Sub showimage()
        showbx.Show()
    End Sub
    Public Sub hideimage()
        showbx.Hide()
    End Sub


0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12077350
Try:

showimage

Application.DoEvents <-- add this.

Fill
hideimage

Bob

0
 

Author Comment

by:malanois
ID: 12077407
hmmmmm????????

The gif comes up,

however the animation only shows on bar and hangs.???


0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 96

Expert Comment

by:Bob Learned
ID: 12077424
What happens if you don't do the Fill and don't hide the image?  Does the animation work correctly?

Bob
0
 

Author Comment

by:malanois
ID: 12077486
yes it works if i dont hide and unhide

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12084539
Take a look here:

http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21132894.html#12081514

I learned something new, without even having to ask a question :)

Bob
0
 

Author Comment

by:malanois
ID: 12087463
that is great

Thank You so Much

:)

MJ
0
 

Author Comment

by:malanois
ID: 12087963
Well now you got me thinking,

Im trying to play with this.

Ive searched a couple items about thread and I keep getting errors

 Private thread As System.Threading.Thread

    Public Sub Threading()
        thread = New System.Threading.Thread(showimage)

    End Sub


    Public Sub showimage()
        showbx.Show()
    End Sub
    Public Sub hideimage()
        showbx.Hide()
    End Sub

?????????????????????

MJ
0
 
LVL 10

Expert Comment

by:eternal_21
ID: 12092316
malanois, I have converted the code to VB for your convienence:


  Public Sub ShowImage()

    pictureBox.Show()

  End Sub

  Public Sub HideImage()

    pictureBox.Hide()

  End Sub

  Private Sub DoWork()

    ShowImage()

    // Do your work here

    HideImage()

  End Sub

  Private Sub StartDoWork()

    Dim workThread As New System.Threading.Thread(AddressOf DoWork)
    workThread.Start()

  End Sub


Just call StartDoWork() to get the process going!
0
 

Author Comment

by:malanois
ID: 12092509
thanks
0
 
LVL 10

Expert Comment

by:eternal_21
ID: 12092587
SOORY, Don't know what I was thinking, but I never finished the code!

Correction to these two functions:

    Private Sub DoWork()

        Invoke(New System.Threading.ThreadStart(AddressOf ShowImage))

        System.Threading.Thread.Sleep(5000)

        Invoke(New System.Threading.ThreadStart(AddressOf HideImage))

    End Sub

    Private Sub StartDoWork()

        Dim workThread As New System.Threading.Thread(AddressOf DoWork)
        workThread.IsBackground = True
        workThread.Start()

    End Sub
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now