title: C# AutoSize DatagridView Populated By Linq Query
body: <p>I have a datagridview control that is populated by a linq query:</p>
  
  <pre><code>public static IQueryable SearchByDepartmentNameInfo(string deptName)
      {
  
          ExamineDataContext dc = new ExamineDataContext();
  
          var queryResult = from q in dc.GetTable&lt;Question&gt;()
                            where q.Topic.Module.Department.DepartmentName.Equals(deptName)
                            join s in dc.Solutions
                            on q.QuestionID equals s.QuestionID
                            into qs // note grouping        
                            select new
                            {
                                Module = q.Topic.ModuleTitle,
                                Topic = q.TopicName,
                                Question = q.QuestionText,
                                QuestionType = q.QuestionType,
                            };
          return queryResult;
      }
  
  dataGridView1.DataSource = Repository.SearchByDepartmentNameInfo("Computer Science");
  </code></pre>
  
  <p>I want the datagridview to automatically resize the columns based on the data returned from the query.</p>
  
  <p>Help appreciated greatly.</p>