Results 1 to 4 of 4

Thread: Filter text disappearing in C1TrueDBGrid VB.NET 2003

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    675

    Filter text disappearing in C1TrueDBGrid VB.NET 2003

    Edit: VB.Net 2003

    Hello,
    I am using a C1TrueDBGrid (a ComponentOne object) that allows filtering on each column. My problem is that when I refresh data any text in the filter boxes on the grid are erased. The filtering still works because that is saved, but the text itself disappears. There is another place in the program where this doesn't happen, and I think I know why. In the other place the Datasource is set in the designer. However, this part of the program needs to be very dynamic, so the dataset is built on the fly and then bound to the grid.

    VB Code:
    1. ds.Clear()
    2. sqlDA.Fill(ds.Tables(0))
    3. Me.tdbgrdCPE.SetDataBinding(ds.Tables(0), "", True)

    Is this what is causing any text in the filter boxes to disappear?

    Also, like I said, the filter string is saved, but you can't just set the grid's filter to the filter string and have it repopulate those filter boxes. Any ideas? Or am I just screwed?
    Last edited by 18experience; Mar 23rd, 2010 at 09:37 AM.

  2. #2
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: Filter text disappearing in C1TrueDBGrid VB.NET 2003

    Hi Mate,

    I also use the same grid. How do you set the filtering for the grid?

    Cheers,

    Jiggy!

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2006
    Posts
    675

    Re: Filter text disappearing in C1TrueDBGrid VB.NET 2003

    I think you set the FilterBar property to true, but I'm not the one who did it. By the way, the problem was these lines (not sure which exactly):
    VB Code:
    1. Me.tdbgrd.Columns.Clear()
    2. Me.tdbgrd.Splits(0).DisplayColumns.Clear()
    and here is how I fixed it:
    VB Code:
    1. Public ColumnFilterText As New ArrayList
    2. Private Sub SaveColumnFilterText()
    3.         Me.ColumnFilterText.Clear()
    4.         For Each col As C1DisplayColumn In Me.tdbgrd.Splits(0).DisplayColumns
    5.             Me.ColumnFilterText.Add(col.DataColumn.FilterText)
    6.         Next
    7.     End Sub
    8. Private Sub ReloadColumnFilterText()
    9.         Dim i As Integer = 0
    10.         For Each col As C1DisplayColumn In Me.tdbgrd.Splits(0).DisplayColumns
    11.             If i = Me.ColumnFilterText.Count Then Exit For
    12.             col.DataColumn.FilterText = Me.ColumnFilterText.Item(i)
    13.             i += 1
    14.         Next
    15.     End Sub
    VB.Net 2008
    .Net Framework 2.0

    "Must you breathe? 'Cause I need heaven..."

  4. #4
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,806

    Re: Filter text disappearing in C1TrueDBGrid VB.NET 2003

    Thanks mate for your help!

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