glewis1636
Programmer
I am creating a form in a windows application that has a datagrid, and two textboxes and a label. I need to filter the datagrid based on the value in the label. I can do this with no problem using a dataview, but the problem comes in when I try to alter the format of the datagrid to hide certain columns and change the column names, etc.
I have tried using a dataviewmanager rather than a dataview, and I get the datagrid in the form I want, but the dataviewmanager will not change the returned data if the value in the label changes. I have stepped through the code and the rowfilter for the dataviewmanager changes, but the dataviewmanager still only returns the data from the initial filter. I have tried clearing the table, and filling the dataset again before going through the dataviewmanager with the same results, ie it keeps the original filter value.
Here is my code for the dataviewmanager
The textboxes contain values from two of the columns in the datagrid, and these are two of the columns I want to hide. I want to be able to update them, so I can't just leave them out of my initial select statement.
Any ideas would be greatly appreciated. This has been bugging me for days now!
Thanks!
I have tried using a dataviewmanager rather than a dataview, and I get the datagrid in the form I want, but the dataviewmanager will not change the returned data if the value in the label changes. I have stepped through the code and the rowfilter for the dataviewmanager changes, but the dataviewmanager still only returns the data from the initial filter. I have tried clearing the table, and filling the dataset again before going through the dataviewmanager with the same results, ie it keeps the original filter value.
Here is my code for the dataviewmanager
Code:
Try
Dim rfFilterOtrMac As String
rfFilterOtrMac = "ProspectID = " + lblOtrMachProspID.Text
dvmProspect.DataViewSettings("OtherMach").RowFilter = rfFilterOtrMac
dvmProspect.DataViewSettings("OtherMach").RowStateFilter = DataViewRowState.OriginalRows
dgOtrMach.DataSource = dvmProspect
dgOtrMach.DataMember = "OtherMach"
txtComments.DataBindings.Add("Text", dvmProspect, "OtherMach.Comments")
txtOtrMacProspID.DataBindings.Add("Text", dvmProspect, "OtherMach.ProspectID")
Any ideas would be greatly appreciated. This has been bugging me for days now!
Thanks!