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

DataGridViewComboBox not displaying stored value if one of the items in the list is inactivated

$
0
0

I have a DataGridView   
The Grid itself has a DataSource of tblAttach_Sent_ToBindingSource which is a listing of Companies that the paperwork has been sent to.
I have one of the columns set up as a ComboBox where the DataPropertyName is set to the table column I wish to get the  name from (ATTACHMENT_SENT_TO).
The fields are:
ID_ATTACHMENT_SENT_TO (hidden)
JMNU (hidden)
Attachment_Sent_To--this is the combobox
Notice_Returned
Data Transfer Request


I've given the combobox a DataSource that is filled with 'ACTIVE' names of Companies that these attachments can be sent to.  Everything works great until one of the Companies is 'Inactivated'.  then the existing rows which have this particular company in them are no longer displayed correctly and an error pops up  

System.ArgumentException: DataGridViewComboBoxCell value is not valid

How do I get the ComboBox to display only the Active choices for a Company in the drop down list and yet still display the Companies that have already been stored in the parent table with any Inactivated Company names?

Below is the setup for the ComboBox
            // aTTACHMENTSENTTODataGridViewComboBox
            // 
            this.aTTACHMENTSENTTODataGridViewComboBox.DataPropertyName = "ATTACHMENT_SENT_TO";
            this.aTTACHMENTSENTTODataGridViewComboBox.DataSource = this.tlkp_Attacher_CompanyBindingSource;
            this.aTTACHMENTSENTTODataGridViewComboBox.DisplayMember = "Attacher_Name";
            this.aTTACHMENTSENTTODataGridViewComboBox.HeaderText = "ATTACHMENT SENT TO";
            this.aTTACHMENTSENTTODataGridViewComboBox.Name = "aTTACHMENTSENTTODataGridViewComboBox";
            this.aTTACHMENTSENTTODataGridViewComboBox.ValueMember = "Attacher_Name";
            this.aTTACHMENTSENTTODataGridViewComboBox.Width = 160;


I've tried this combobox as above but also with .Valuemember:NONE and with .DisplayMember:NONE.  both of these options do not operate correctly with out without the Inactivated Company.


Viewing all articles
Browse latest Browse all 2535

Trending Articles



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