Link to home
Start Free TrialLog in
Avatar of malanois
malanois

asked on

OLEAdapter Fill ISALIVE

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
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

What are you trying to accomplish here?

Bob
Avatar of malanois
malanois

ASKER

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
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
What would be some options?

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

Thank YOU
MJ
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

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


Try:

showimage

Application.DoEvents <-- add this.

Fill
hideimage

Bob

hmmmmm????????

The gif comes up,

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


What happens if you don't do the Fill and don't hide the image?  Does the animation work correctly?

Bob
yes it works if i dont hide and unhide

Take a look here:

https://www.experts-exchange.com/questions/21132894/run-animated-gif-on-onclick.html#12081514

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

Bob
that is great

Thank You so Much

:)

MJ
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
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!
thanks
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