title: DevExpress GridView Auto Size Columns
body: <p>I'm trying to get <strong>all</strong> of my columns to expand so that the title of the columns are fully visible. I am not bothered about expanding based on the values as some columns contain long values - if needed I can expand these out manually in the UI.</p>
  
  <p>But i cant seem to get the Column names to expand so they're visible. I've tried something like this in my form load event:</p>
  
  <pre><code>        con.open()
          com = New SqlCommand('SQL Command to return data is here')
          DataTable.Load(com.ExecuteReader)
          GridControl1.DataSource = DataTable
          GridControl1.DataMember = DataTable.TableName
          con.close()
  
      GridView1.OptionsBehavior.Editable = True
      GridView1.OptionsBehavior.AutoExpandAllGroups = True
      GridView1.OptionsView.ColumnAutoWidth = True
      GridView1.OptionsView.BestFitMaxRowCount = -1
      GridView1.VertScrollVisibility = True
      GridView1.HorzScrollVisibility = True
  </code></pre>
  
  <p>But the code still returns the bellow output. I have both the scroll bars visible so I don't see why the table isn't expanding out and using the horizontal scroll bar to 'slide' to see more. </p>
  
  <p>Can anyone see why this isn't working?</p>
  
  <p><img src="https://i.stack.imgur.com/sCPTH.png" alt="Figure 1"></p>
  
  <p>Also, I'm using the DevExpreses's GridControl.</p>