evan liewer

evan liewer

  • NA
  • 25
  • 35.8k

ComboBox in DataGridView Shows ValueMember and not Display Member

Sep 15 2012 11:43 AM
I  have a dataGridView that one of the columns needs to be a dropdown box.  I used the built in functions of VS to create the form.  Everything works, when I click on the box it displays the correct text and it will update my SQL with the value member.  However, when the form loads, it shows the ValueMember for every column.  Only when clicking does it show the text description.  here is the code VS created

   // 
            // lmpackagingDataGridViewTextBoxColumn
            // 
            this.lmpackagingDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
            this.lmpackagingDataGridViewTextBoxColumn.DataPropertyName = "lm_packaging";
            this.lmpackagingDataGridViewTextBoxColumn.DataSource = this.packageBindingSource;
            this.lmpackagingDataGridViewTextBoxColumn.DisplayMember = "PKG_DESC";
            this.lmpackagingDataGridViewTextBoxColumn.HeaderText = "Packaging";
            this.lmpackagingDataGridViewTextBoxColumn.Name = "lmpackagingDataGridViewTextBoxColumn";
            this.lmpackagingDataGridViewTextBoxColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
            this.lmpackagingDataGridViewTextBoxColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
            this.lmpackagingDataGridViewTextBoxColumn.ValueMember = "PKG_ID";


thank you