CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2007
    Posts
    30

    dataview filter applies automaticly in defaultview - avoid this?

    how can i avoid the filter to apply automaticly to default view

    i have here a table "players" and when i started my program i thought at using a separate view from the dataview to easily work with data. this dataview is called "playerview"

    but while i am working in my program and applying filters to playerview, the filter goes automaticly to players.defaultview and i need the default view.rowfilter to be empty so i can apply a different filter from the playerview.

    thanks for trying to understand my problem

    btw when i declared i used
    Public playerview As DataView and after datatable is filled
    playerview = players.DefaultView

  2. #2
    Join Date
    Dec 2003
    Location
    Northern Ireland
    Posts
    1,362

    Re: dataview filter applies automaticly in defaultview - avoid this?

    Instead of
    Code:
    playerview = players.DefaultView
    try
    Code:
    playerview.Table = players
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook


    0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010

  3. #3
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: dataview filter applies automaticly in defaultview - avoid this?

    If you are FILTERING data, like you say, then you need to use the .Filter property.

    I combine 3 tables into one temp table. I show only a few fields for each record in a grid on top, and a tabbed view for each field in the temp table.

    I load the temp table into a grid, after applying the 'default' filter. (they only see ALL of 'their' records, not the whole db)

    From there, I ADD TO THE FILTER, so they see less records.
    Code:
    ' var.Filter = var.Filter + NewFilter
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured