none
combobox bound to Business Object property RRS feed

  • Question

  • Hi all

    I have a winform with a combobox that has a Table as DataSource. 

     Private Sub SetComboBoxNazioneDes()
            RegioneNazioneDesComboBox.DataSource = DTNazioni.DefaultView
            RegioneNazioneDesComboBox.ValueMember = "NazioneID"
            RegioneNazioneDesComboBox.DisplayMember = "NazioneDes"
            RegioneNazioneDesComboBox.DropDownStyle = ComboBoxStyle.DropDown
            RegioneNazioneDesComboBox.AutoCompleteSource = AutoCompleteSource.ListItems
            RegioneNazioneDesComboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend
        End Sub

    The combobox.text property is Bound to a BusinesObject propery (let's say BONazioneDes as String)

    When I select an item on combobox from the dropdown list the combobox.text item is well displayed but when I leave the combobox going to other control in the form the BO property is not update.

    The BO property is updated only if I go back again in combobox control.

    So what I miss ?

    Tuesday, December 18, 2018 9:47 AM

Answers

  • SOLVED, and this is the solution:

    If your BO class has name ClassBO that is a datasource for textbox or combobox or other controls in the form so there is a ClassBOBindingSource automatically create for the Form 

    If you change runtime a control.text property bound to a BO property (without clicking on the control) then you have to call 

    ClassBO.Endedit 

    method to update the BO property.


    • Marked as answer by Claudio111 Tuesday, December 18, 2018 11:22 AM
    Tuesday, December 18, 2018 11:22 AM