Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: combobox VB.NET drop-down , +
I would like to set the DropDownStyle to DropDown in a ComboBox that is in a DataGridView control. I would like to do this by setting this property at design time; however, it isn't an option I can pick. Doing it when the form loads would be fine, but I don't know how to do it (VB.net, please).
 
Thanks, Eddie
Posted 22-Jan-11 12:00pm
Edited 22-Jan-11 13:52pm
Henry Minute223.8K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If your ComboBox is part of a ComboBoxColumn then Manfred's solution might not work.
 
Take a look at this[^] thread on MSDN.Social (Scroll down until you see the first message from 'mcassoc') and in that message take note of the event handler for the EditingControlShowing event. Using that code to handle that event on your DataGridView will enable you to achieve what you want.
  Permalink  
Comments
Sandeep Mewara at 23-Jan-11 3:39am
   
Comment from OP:
Henry is right... Manfred's answer won't apply if the ComboBox is part of a ComboBoxColumn. I'm still trying to digest Henry's answer to see if it will work. My background is from VBA. Who would think that a "Limit to List Y/N" would be so powerful? Do you think a later release of VB.net might provide that simple(?) property?
 
Thanks, Eddie
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can do it from your forms load event or in the forms constructor:
    ...
    Me.ComboBox1.DropDownStyle = ComboBoxStyle.DropDown
    ...
 
Hope that helps you.
 
Best Regards,
Manfred
  Permalink  
Comments
Nishant Sivakumar at 22-Jan-11 18:56pm
   
Voted 5, proposed as answer.
Nishant Sivakumar at 22-Jan-11 20:15pm
   
After reading Henry's reply, I retract my proposal as answer, but my 5 remains.
Sandeep Mewara at 23-Jan-11 3:39am
   
Comment from OP:
Henry is right... Manfred's answer won't apply if the ComboBox is part of a ComboBoxColumn. I'm still trying to digest Henry's answer to see if it will work. My background is from VBA. Who would think that a "Limit to List Y/N" would be so powerful? Do you think a later release of VB.net might provide that simple(?) property?
 
Thanks, Eddie

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 310
1 OriginalGriff 285
2 Afzaal Ahmad Zeeshan 200
3 Sergey Alexandrovich Kryukov 195
4 BillWoodruff 180
0 OriginalGriff 6,499
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,193
3 Manas Bhardwaj 4,657
4 Maciej Los 4,120


Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 22 Jan 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100