Solved

OLEAdapter Fill  ISALIVE

Posted on 2004-09-16
16
386 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
[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
  • 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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

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
 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

623 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