Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
390
' Problem with ultracombo DropDownStyle = DropDownList - losing ultracombo.value
posted

I am having a problem with an ultracombo losing the ultracombo.value under the following circumstance - code and comments below.  The code is VB

' Problem with ultracombo DropDownStyle = DropDownList - losing ultracombo.value

' Design Time settings for ultracombobox - cboPatientProviderList
        Me.cboPatientProviderList.DataBindings.Add(New System.Windows.Forms.Binding("Value", _
                     Me.PatientBindingSource, "fk_pers_prov_ProviderKey", True))
        Me.cboPatientProviderList.DataSource = Me.ProviderListBindingSource
        Me.cboPatientProviderList.DisplayMember = "prov_LastName"
        Me.cboPatientProviderList.ValueMember = "pk_prov_ProviderKey"
        Me.cboPatientProviderList.DropDownStyle = _
                    Infragistics.Win.UltraWinGrid.UltraComboStyle.DropDownList

        Me.ProviderListBindingSource.DataMember = "ProviderList"
        Me.ProviderListBindingSource.DataSource = Me.ProviderDataSet

' Form Load
        Me.ProviderDataSet.ProviderList.Clear()
        Me.ProviderListTableAdapter.Fill(Me.ProviderDataSet.ProviderList)
' At this point cboPatientProviderList binds and populates just fine
' cbo.PatientProviderList.value = nnn from the fk_pers_prov_ProviderKey through the DataBinding above

' At any time the user may request that the cbo.PatientProviderList DataSource be refreshed in which case the following code is invoked
        Me.ProviderDataSet.ProviderList.Clear()
        Me.ProviderListTableAdapter.Fill(Me.ProviderDataSet.ProviderList)
' The datasource refreshes, the cboPatientProviderList rebinds and shows any updates, however the
' cbo.PatientProviderList.value = Nothing - Has it lost the fk_pers_prov_ProviderKey DataBinding
' even though nothing was done to the PatientBindingSource?

' However if at design time the DropDownStyle = DrowDown (not DropDownList)
' then cbo.PatientProviderList.value is not lost when the cbo.PatientProviderList DataSource is refreshed

Parents
  • 469350
    Verified Answer
    Offline posted

     If the Combo is in DropDownList style, then it cannot accept any value that is not on the list. So if you reset the data source, there will be a time when there are no items on the list - therefore the Combo will lose it's value.

        In DropDown style, this doesn't happen, because the combo can accept a value that is not on the list, so it maintains the value when all the items are cleared.  

Reply Children
No Data