ComboBox in DataGridView

T

tk

I have a form that has a DataGridView control (.NET 2.0) on it. I am using
a combobox in one of the columns and it works fine. The only problem that I
have is that the box with the arrow is displayed for all the rows all of the
time for that column. I would like to hide the box with the arrow until the
cell gets the focus. Is this possible?

I use the following code to build the DataGridView:

dgvTemplates.AutoGenerateColumns = false;

DataGridViewTextBoxColumn col1 = new DataGridViewTextBoxColumn();

col1.DataPropertyName = "Id";

dgvTemplates.Columns.Add(col1);

DataGridViewComboBoxColumn col2 = new DataGridViewComboBoxColumn();

col2.DataSource = dtGrade;

col2.DisplayMember = "Grade";

col2.ValueMember = "Grade";

col2.DataPropertyName = "Grade";

col2.HeaderText = "Grade";

dgvTemplates.Columns.Add(col2);


Thanks,

Tim
 
J

Jeff Johnson

I have a form that has a DataGridView control (.NET 2.0) on it. I am using
a combobox in one of the columns and it works fine. The only problem that
I have is that the box with the arrow is displayed for all the rows all of
the time for that column. I would like to hide the box with the arrow
until the cell gets the focus. Is this possible?

Check out the DataGridViewComboBoxColumn.DisplayStyle property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top