How can I combine checkbox and comobox behavior in VB.nET

Joined
Jun 8, 2006
Messages
5
Programming Experience
Beginner
Hi all,

I want to have checkbox as well as combobox as one of the column type in my datagridview. There are a lot of 3rd party software available to emulate for this kind of behavior. I want a similar behavior.

Idea is to give the user multiple choice in a combo box and then he can select one of more choices.

Could someone provide me with some hints or sample code.

Regards,
Raj
 
You're going to have to create your own column type. You could use a ListBox or CheckedListBox as the editing control. You're going to have to do some work though as you will have to create your own column, cell and editing control classes. The DataGridView is very powerful and allows you to do all sorts of things, but you've still got to do them. Below are a couple of links to show you how to create your own column types. The second has an example of a column in which each cell can contain multiple RadioButtons I believe, although I haven't looked at it closely. You could probably do something similar with multiple CheckBoxes, although I think the ListBox or CheckedListBox would be better.

http://msdn2.microsoft.com/en-us/library/7tas5c80.aspx
http://www.windowsforms.net/WhidbeyFeatures/default.aspx?PageID=2&ItemID=13&Cat=Controls
 
Help : combobox with checkboxes

I started creating the stuff together. I am now inheriting the editingControl from checkedListBox, and inheriting the custom cell from DataGridViewComboBox cell. The issue is that when the form comes up, the cell has the combobox property, but when edited, the cell shows the checkedListBox inside the cell.....instead of showing it like a pop up ( the way the combobox behavior is).

How do I exactly mimic the behavior of combobox such that it shows just simple text and shows a pop-down menu with checkboxes and Strings alongside.
 

Attachments

  • DataGridView_Form_onLoad_edited.jpg
    DataGridView_Form_onLoad_edited.jpg
    13.4 KB · Views: 106
  • DataGridView_Form_whenEdited_edited.jpg
    DataGridView_Form_whenEdited_edited.jpg
    14.7 KB · Views: 108
quicksilverm26 said:
Idea is to give the user multiple choice in a combo box and then he can select one of more choices.
What you describe is actually the behaviour of a regular combobox. :)
 
Please note that I had mentioned "one or more" choices in my statement "
Idea is to give the user multiple choice in a combo box and then he can select one of more choices."

Current Behavior of combo box only lets a single selection. I wanted a checkbox with combobox so I could achieve the multi-select option.
 
Back
Top