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:
ds.Clear()
sqlDA.Fill(ds.Tables(0))
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?
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!
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:
Me.tdbgrd.Columns.Clear()
Me.tdbgrd.Splits(0).DisplayColumns.Clear()
and here is how I fixed it:
VB Code:
Public ColumnFilterText As New ArrayList
Private Sub SaveColumnFilterText()
Me.ColumnFilterText.Clear()
For Each col As C1DisplayColumn In Me.tdbgrd.Splits(0).DisplayColumns
Me.ColumnFilterText.Add(col.DataColumn.FilterText)
Next
End Sub
Private Sub ReloadColumnFilterText()
Dim i As Integer = 0
For Each col As C1DisplayColumn In Me.tdbgrd.Splits(0).DisplayColumns
If i = Me.ColumnFilterText.Count Then Exit For
col.DataColumn.FilterText = Me.ColumnFilterText.Item(i)
i += 1
Next
End Sub
Re: Filter text disappearing in C1TrueDBGrid VB.NET 2003
Thanks mate for your help!