Solved

OLEAdapter Fill  ISALIVE

Posted on 2004-09-16
16
379 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 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