I have looked at several posts and answers related to autoresize but I don't see an the answer (or more likely, I don't understand how to apply). The call to autoresize does not seem to do anything to my dgv. I have tried several variations per the posts. I have attached my code. It is probably something dumb. Any suggestions would be appreciated.
public frmSearchResults(string sql, Connection oConn)
{
InitializeComponent();
//Pull the specialty information in.
dgvSearchResults.DataSource = null;
dgvSearchResults.Columns.Clear();
DataSet dsData = oConn.ExecuteDataSet(sql, false);
BindingSource bsData = new BindingSource();
bsData.DataSource = dsData.Tables[0];
dgvSearchResults.DataSource = dsData.Tables[0];
dgvSearchResults.Columns["ENTITY_TYPE_CODE"].HeaderText = "Type Code";
//dgvSearchResults.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells);
dgvSearchResults.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
this.Refresh();
}