Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Unable to set inital string "Monday" to datagridview Combox in Defaultvaluesneeded in C#

$
0
0

Hi,

   unable to set  the below string  value to Combox in Datagridview in DefaultValuesneeded

        e.Row.Cells["Type"].Value = "P";

        Pop up the Below error:

      System.ArgementException:DataGridViewComboBoxCell Value is not valid

    Please reply back if you know the answer.

Thanks

Implemented  this code,  while running  i got the below error.

 for (int i = 0; i < ProcurementDetailsDataGridView.Rows.Count; i++)
            {
                DataGridViewComboBoxCell cell = ProcurementDetailsDataGridView.Rows[i].Cells["Type"] as DataGridViewComboBoxCell;
                if (cell != null)
                {
                    cell.Items.Add("P");
                    cell.Items.Add("PR");
                  
                }
            }

After  Implementation  i  got this error.

ArgumentException was unhandled

Items collection cannot be modified when the DataSource property is set.



Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>