0
I am using a Gridlookupedit, and I would like to hide the first column, and adjust the size of the others, however I am using gridLookUpEdit2View.Columns[0].Visible = false;
and the gridLookUpEdit2.Properties.View.Columns[0].Visible = false;
yet of error:
Additional information: The index was out of range. It should be non-negative and smaller than the collection size.
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;
}