how to get value of user type column into combox box , user type is 2nd table first is user so in combo box there's a list for example doctor ,abc,xyz
and iam working on windows application data grid view cellContent click event when i click on any cell all values r get into textboxes but usertype when i click i get value of usertype but again click on another cell i getting values of first click and second click both .

1 Year
Discussion Span
Last Post by JOSheaIV

this is code and design view see in design view combo box

Attachments combobox.png 18.05 KB combobox2.png 18.12 KB comboboxcode.png 19.63 KB

So it sounds like you want to populate your ComboBox with all the distinct values from a column.

Look for the event "CellValueChanged" in the DataGridView. This should fire after the cell's value has been edited, and focus has left the cell (so like leaving edit more).

However, I would suggest, that when they leave editing, you get all the distinct values from a column, that way in case they changed one that's no longer present, it's not in the ComboBox. Just google something like "Select Distinct Values Datagridview column" or something like that (make sure you clear the ComboBox first if you do this)


i tried to clear combo box but still not clear combo box
like .. combobox1.items.clear();
but not working


should be comboBox1.Items.Clear(); That should remove all items in the ComboBox (if that is not working make you are executing it on the correct ComboBox and don't have some code trying to repopulate it before you desire).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.