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 .

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

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();
oR
combobox1.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).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.