Solved

OLEAdapter Fill  ISALIVE

Posted on 2004-09-16
16
370 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

13 Experts available now in Live!

Get 1:1 Help Now