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
List
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;
}
}
}
Amit ChoudharyPosted Aug 16, 2011, 7:02 AM
you should debug this code line by line analyzing the data with watches, See If the flow is correct with the data that is coming Because by looking at the code, its not possible to tell the error because if its a bug then first you've to debug the code properly to find the bug.