How to set the max number of entries to show in a drop down box

I have a datagridview that has a number of drop down boxes.  There are over 25 entries that show in the drop down box and the top value is blank.  Unfortunately the drop down box extends to the top of the screen and  is covering other information.  How can I set the max number of entries that will show at one time along with a scroll bar to see the rest of the items.  When I look at each column that is a combo box in the data grid, it has 8 set as the maximum drop down items, but that is not working.  I have also changed it to another number,but it still is not working.  Does anyone have any suggestions on how to solve this?
LenTompkinsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dimajCommented:
Take a look at this link: http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.aspx

There is a property called MaxDropDownItems which is part of a ComboBox. This property should do what you are trying to achieve.
0
LenTompkinsAuthor Commented:
I tried that with this code as well as putting the max value in each column of the datagrid.

 //Set Binding for "PrefStartTime" Drop-down column
            this.PrefStartTme.DataPropertyName = "PrimaryStartChar";
            this.PrefStartTme.DataSource = this.m_dtStdCallingTime;
            this.PrefStartTme.DisplayMember = "CallingTimeChar";
            this.PrefStartTme.ValueMember = "CallingTimeChar";
            this.PrefStartTme.MaxDropDownItems = 10;
           
I still get all of the values
0
Todd GerbertIT ConsultantCommented:
Set IntegralHeight on your ComboBox to false, the MaxDropDownItems should take effect.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

LenTompkinsAuthor Commented:
Great, but I am a beginner and I can't see how we set the IntegralHeight or the DropDownHeight.  Can you give a code example?  
Thanks
0
LenTompkinsAuthor Commented:
I have tried :
this.cbxprefStart.IntegralHeight = false; which gives me an error setting the individual Combo box
this.gdvCallingTime.IntegralHeight = false;  gives me an error when setting the datagridview which holds
0
LenTompkinsAuthor Commented:
sorry I hit enter by mistake

but the dgv holds the combo boxes that I want to change.
0
dimajCommented:
correct, so you can change it at design time or at run time.
To change it at run time, you can use code you've listed above and just append the line I mentioned erlier.
To change it at design time, click on your dgv. You should see a little arrow in the upper right corner. When you click on it, you should be able to change properties for each column of your datagridview. Change properties you need and you won't have to mess with the code behind.

p.s. I assume you're working with Visual Studio.
0
LenTompkinsAuthor Commented:
//Set Binding for "PrefStartTime" Drop-down column
            this.PrefStartTme.DataPropertyName = "PrimaryStartChar";
            this.PrefStartTme.DataSource = this.m_dtStdCallingTime;
            this.PrefStartTme.DisplayMember = "CallingTimeChar";
            this.PrefStartTme.ValueMember = "CallingTimeChar";
            this.PrefStartTme.IntegralHeight = false;
            this.PrefStartTme.MaxDropDownItems = 9;

I get the following error:
'System.Windows.Forms.DataGridViewComboBoxColumn' does not contain a definition for 'IntegralHeight' and no extension method 'IntegralHeight' accepting a first argument of type 'System.Windows.Forms.DataGridViewComboBoxColumn' could be found (are you missing a using directive or an assembly reference?)

I even tried it earlier in when I load the form and I get the same error.  Is there a different using statement that I need?
0
Todd GerbertIT ConsultantCommented:
IntegralHeight is for the drop-down/combo-box, not the grid view.
0
LenTompkinsAuthor Commented:
this.PrefStartTme is my combo box within my grid and I tried to set the IntegralHeight on this element.  Is this not the correct element to set it to?
0
LenTompkinsAuthor Commented:
I needed to upgrade the platform I am using to make this work.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.