Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datagrid tablestyles w/dataview problem

Status
Not open for further replies.

glewis1636

Programmer
Apr 26, 2004
39
US
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
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")
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!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top