dc

dc

  • NA
  • 663
  • 0

C#.net linq problem

Aug 12 2011 7:10 PM

I am having a problem trying to determine what is causing a linq problem in a C#.net 2008 desktop application.

When the table is displayed in a datagrid that has data populated in in by a linq command everything is fine. However, when a user selects any 'category' from  a dropddown list in the windows application, one of the columns that were originally displayed in the datagrid disappears. I am trying to determine what to look at (and/or debug) to determine what is causing the error.

The following is the code when the error is noticed from:

private void HideCol(BrowserGrid dgv, string qName, string Type)
        { 
            QueryType cQuery = queries.Find(delegate(QueryType q) {
return q.TypeName.Equals(qName); });

            List<string> possibleCol = new
List<string>(cQuery.ColumnCollection); 

           QRec recTypeQuery = queries.Find(delegate(QRec q) {
return q.RecTypeName.Equals(recType.Trim()); });
            if (rQuery != null)
            {
              possibleCol.AddRange(rQuery.ColumnCollection); 
            }

            foreach (DataGridViewColumn col in dgv.Columns)
            { 
                 (CaseInsensitiveContains(posCol, col.DataPropertyName))
                {
                    dgv.Columns[col.Name].Visible = true;
                }
                else
                {
                    dgv.Columns[col.Name].Visible = false;
                }
            }
        }


Answers (1)