In cellvalidating event
Thanks Prince of Dhump Thanks to both of you for the replies but I still have probelms. Initially when the Data Grid View loads it doesn't show any row until the user clicks on Add button. When the row is displayed this Combo Box is filled in by default but doesn't show any record rather a bluish color which represents cursor.
I don't know but I've put 2-3 times this same question but i still haven't got a full reply of how to get rid of this thing. I have one Data Grid View and I'm using it for taking input. Fund Code, Fund Description, Account No, Amount and Description. I want to display the first record by default when the row is added to this Combo Box or atleast find a way to control if there is no value in Combo Box column for any row.
I set the first the colum as a Combo Box column which is Databind.
My question is how can I know the value of Combox Box column or identify the cell as Combo Box in Cell Validating event of the Data Grid View.
The second dropdownlist is dependant on the first one.
Both columns are added as id fields in 3rd table, and both the columns have picklist data coming from there parent tables.
An alternative way would be to add the items to the Data Grid View Combo Box Column control directly, as shown: '---adding columns--- Data Grid View1.
Data Source = bindingsource '---add a combobox column to the Data Grid View control--- Data Grid View1. Add(combo Box Col) The previous code showed how you can bind a Binding Source control (containing a list of items to let the users choose) to a Data Grid View Combo Box Column control inside a Data Grid View control.
The Data Bound Item will be updated only if the cell is validated.
Now Prince of Dhump Hi Rajat, I'm using different combination now. Apart from that i'm using these events for combobox so if a column is not clicked by mouse still it will ask.