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,

I am unable to set  inital string "Monday"  to datagridview Combox in Defaultvaluesneeded in C#or

this leads to error popup

System ArgumentException: DatagridViewComboBoxCell value is not valid.

Please  let me know your inputs .

Thanks in advance.

Thanks

Sudheer

This is the code

 private void ProcurementDetailsDataGridView_DefaultValuesNeeded(object sender, DataGridViewRowEventArgs e)
        {
                      
            e.Row.Cells["Type"].Value = "P";
            e.Row.Cells["P1"].Value = 0;

         }

        private void Purchase_Load(object sender, EventArgs e)
        {

            this.Size = new Size(960, 477);
         
            // TODO: This line of code loads data into the 'mySaleLDataSet.TransactionType' table. You can move, or remove it, as needed.
            this.transactionTypeTableAdapter.Fill(this.mySaleLDataSet.TransactionType);
            // TODO: This line of code loads data into the 'mySaleDataSet.ProductInformation' table. You can move, or remove it, as needed.
            this.productInformationTableAdapter.Fill(this.mySaleDataSet.ProductInformation);
        
            SetSupplier();
            SaveStorageSingleButton.Enabled = true;
            ProcurementDetailsDataGridView.AutoGenerateColumns = false;
            //For Datatable
            MyTable = new DataTable("ProductsDesc");
            MyTable.Columns.Add("Product", typeof(string));
            MyTable.Columns.Add("Type", typeof(string));
           
           
            gridquantity.ColumnHeadersDefaultCellStyle.BackColor = Color.LightYellow;
            ProcurementDetailsDataGridView.ColumnHeadersDefaultCellStyle.BackColor = Color.Red;
            ProcurementDetailsDataGridView.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
            ProcurementDetailsDataGridView.ColumnHeadersDefaultCellStyle.SelectionBackColor= Color.LightSeaGreen;
            ProcurementDetailsDataGridView.EnableHeadersVisualStyles =false;

        }

       



Viewing all articles
Browse latest Browse all 2535

Trending Articles



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