Can't get Value from ComboBox

前端 未结 6 2129
时光取名叫无心
时光取名叫无心 2021-01-15 16:04

I have a simple comboBox with some Value/Text items in it. I have using ComboBox.DisplayMember and ComboBox.ValueMember to correctly set the value/text. When I try to get th

6条回答
  •  [愿得一人]
    2021-01-15 16:39

    You are modifying the contents of the ComboBox in SelectedIndexChanged handler. When you modify the contents, it causes the selected items to be unset. Set you are reading in null, which is displayed in the message box as an empty string.

提交回复
热议问题