Link to home
Start Free TrialLog in
Avatar of malanois
malanois

asked on

image, or scrollbar not working.

Situation:

need to show image while doing a .fill

I have tried hiding the datagrid and making the images visible. that didnt work at all.

I tried creating a thread to show image then fill the hide image.  That worked good.  However when I do that the datgrid has dual vertical scroll bars.

so itried to create the thread inside my sub, same result.
Application.doevents hasnt helped.



' Private Sub StartDoWork()
    '  Dim workThread = New Threading.Thread(AddressOf Me.showimage)     <  I have changed this several times
    '  showimage()
    '  workThread.Start()
    '  hideimage()

    ' End Sub

    Private Sub DoWork()

        threadactive = True  ' just for me to know the fill is progress

        Application.DoEvents()
        showimage()

        'Dim workThread = New Threading.Thread(AddressOf Me.showimage)
        'workThread.Start()

        Me.DbDataSet.Clear()

        Me.OleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
       "Data Source=" & DBNAME & ";Persist Security Info=False"

        'Application.DoEvents()
        Me.OleDbDataAdapter1.Fill(Me.DbDataSet)

        '// Do your work here

        hideimage()
        threadactive = False
    End Sub

    Public Sub showimage()                           <-- To show and hide images
        Me.DataGrid.Hide()
        search_lbl.Show()
        showbx.Show()
        showbx1.Show()
    End Sub
 Public Sub hideimage()
        Me.DataGrid.Show()
        search_lbl.Hide()
        showbx1.Hide()
        showbx.Hide()
    End Sub
Avatar of malanois
malanois

ASKER

This is another way I have tried it:

   Private Sub StartDoWork()
        Dim workThread = New Threading.Thread(AddressOf Me.DoWork)
        workThread.background = True
        workThread.Start()
    End Sub

    Private Sub DoWork()

        threadactive = True

        Application.DoEvents()

        showimage()

        'Dim workThread = New Threading.Thread(AddressOf Me.showimage)
        'workThread.Start()

        Me.DbDataSet.Clear()

        Me.OleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
       "Data Source=" & DBNAME & ";Persist Security Info=False"

        'Application.DoEvents()
        Me.OleDbDataAdapter1.Fill(Me.DbDataSet)

        '// Do your work here

        hideimage()
        threadactive = False
    End Sub
ASKER CERTIFIED SOLUTION
Avatar of J_Mak
J_Mak

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
Still not work.  Image just freezes during the .fill process