vb.netwinformsdatagridviewdataviewdatagridviewcomboboxcell

DataGridViewComboboxCell display member not showing up


Goal

A datagridview of SteelTypes has a column that has been bound to a dataview (SteelThicknesses). I can select the data and set it correctly. However I cannot load the same information. My datagridview comboboxcell contains the value and editted formatted text but I cannot set the display member information.

Current problem

I have all of my textbox columns loading correctly except the combobox column. The variable of cbCol is set correctly and the EditedFormattedValue and FormattedValue contain the value I want! However the displayMember does not get replicated into the datagridviewcombobox cell.

I am trying to display a "3" into the Épaisseur (thickness) column via setting its value to a primary key (PK_SteelThickness):

enter image description here

See the results below. Everything except my comboboxcell is populated: enter image description here

Appreciate the help in advance, this has gotten me crazy :)


Solution

  • This is an odd behavior but I found that changing my loading method calls from the new() to the form Load() made it work...

    So I changed my initial code from this:

    Public Sub New()
    
        ' This call is required by the designer.
        InitializeComponent()
    
        ' Add any initialization after the InitializeComponent() call.
        LoadSteelPlates()
        LoadPlateQuotes()
    End Sub
    

    To this:

    Private Sub frmQuotePads_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        LoadSteelPlates()
        LoadPlateQuotes()
    End Sub
    

    This is the only code that was modified and now it works.