I'm using a GridLookUpEdit, and I'd like to hide the first column, and adjust the size of the others, however I'm using gridLookUpEdit2View.Columns[0].Visible = false;
and gridLookUpEdit2.Properties.View.Columns[0].Visible = false;
Additional information: The index was out of range. It should be non-negative and smaller than the size of the collection.
private void cmb_cli()
{
DataTable cli = new DataTable();
string sqconn, _sql;
sqconn = ConfigurationManager.ConnectionStrings["sql brayton max"].ConnectionString;
_sql = @"SELECT id,cd_uf,ds_cidade FROM NotaFiscal.Cidades";
SqlConnection con = new SqlConnection(sqconn);
try
{
SqlCommand cmd = new SqlCommand(_sql, con);
con.Open();
cmd.CommandType = CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(cli);
}
catch
{
}
gridLookUpEdit2.Properties.DataSource = cli;
gridLookUpEdit2.Properties.DisplayMember = "ds_cidade";
gridLookUpEdit2.Properties.ValueMember = "id";
gridLookUpEdit2View.Columns[0].Visible = false;
gridLookUpEdit2.Properties.View.Columns[0].Visible = false;
gridLookUpEdit2.Properties.PopupFormWidth = 500;
}