Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Rowfilter is disappearing

Posted on 2004-10-01
7
Medium Priority
?
179 Views
Last Modified: 2010-04-23
This is a good one,

I have 2 datagrid that are being filtered from another datagrid.  On mouse click event from datagrid1 a variable is being generated.  It then filters datagrid 2, and datagrid3 accordingly.  IT IS FILTERING.  However after the filter datagrid 2 and 3 go back to a blank datagrid.

Here is some code

Private Sub datagridClick(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles DataGrid.MouseDown
        Dim mouseClick As DataGrid.HitTestInfo
        Dim descIndex As Integer
        Dim picIndex As Integer

        If e.Button = MouseButtons.Left Then

            dgObservation = CType(sender, DataGrid)
            mouseClick = DataGrid.HitTest(e.X, e.Y)
            gridRow = mouseClick.Row

            'Get variable of selected rows

            On Error Resume Next
            PnIndex = Me.DbDataSet.T_PARTS.Columns.IndexOf("TRDB_PN")
            Pnname = Me.DbDataSet.T_PARTS.Rows(gridRow)(PnIndex).ToString

            pnmainIndex = Me.DbDataSet.T_PARTS.Columns.IndexOf("PART_NUM")
            pnmain = Me.DbDataSet.T_PARTS.Rows(gridRow)(pnmainIndex).ToString

      Filter_dataview()                <--------- new thread to filter
        End If
          End Sub


Public Sub Filter_dataview()
        Dim workthread2 As New System.Threading.Thread(AddressOf filterdatagrid)
        workthread2.Start()
    End Sub

    Private Sub filterdatagrid()

        dv2.RowFilter = "CHLD = '" & pnmain & "'"   <<<<<<<<--
        dv3.RowFilter = "PRNT = '" & pnmain & "'"  <<<<<<<<<<        These are working
                     
                                           <<<<<<<<<<<<< After the filter this is were it is disapearing
    End Sub
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
  • 4
  • 3
7 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 1000 total points
ID: 12200144
Is Threading a necessary evil here?  It is fairly complex, and IMHO should not be used lightly.

Bob
0
 

Author Comment

by:malanois
ID: 12200908
OK,

If I dont use the thread, my program takes quite a while to complete the filtering.

I mean a while, and the program kind of hangs.

If i click on 1 row I must wait 5-6 seconds to click on another row.

If i use the multithread i have no problems

malanois
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12201061
How much data are you working with here?  Do you need the functionality of a DataSet over a DataReader?  

It could be possible to fill datagrid 2 and 3 with DataReaders and a different version of the Select statement that filled datagrid 1--without having to deal with filters.

Bob
0
Industry Leaders: 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: 12201626
Could you explain?
0
 

Author Comment

by:malanois
ID: 12201650
By the way, lots o data

datagrid 2 and 3 both each are 257,000 records

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12201717
How useful is a datagrid with 257,000 records?

If SQL for 1 = "Select Name From Table"

Then SQL for 2 = "Select Name From Table Where Date Between '01/01/2004' And '10/1/2004' "

Then SQL for 3 = "Select Name From Table Where Date Between '01/01/2004' And '10/1/2004' And Name = 'Bob' "

Bob
0
 

Author Comment

by:malanois
ID: 12226424
Done and fixed, It was a problem with the threading.

The dataset and rowfilter must be in the same thread


malanois
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

609 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