ComboBox. selectedtext attribute
Syntax
C #
Public String selectedtext {Get; set ;}
Attribute Value
Indicates the string of the currently selected text in the combo box. If Dropdownstyle Set Dropdownlist The return value is a null string ("").
ComboBox. selecteditem attribute
Syntax
C #
[Bindableattribute (true)]
Public object selecteditem {Get; set ;}
The property value is the object of the currently selected item. If no item is selected, it is a null reference (nothing in Visual Basic ).
Remarks When Selecteditem When the attribute is set to an object, ComboBox Try to make this object the currently selected object in the list. If this object is found in the list, it is displayed in ComboBox And Selectedindex Set the attribute to the corresponding index. If the object does not exist in the list Selectedindex Property retains its current value.
ComboBox. Text attributes
Gets or sets the text associated with the control.
Syntax
C #
[Bindableattribute (true)]
[Localizableattribute (true)]
Public override string text {Get; set ;}
The text associated with the property value and the control.
Remarks
When set Text When the attribute is null, the null reference (nothing in Visual Basic) or the Null String ("") will Selectedindex Set to-1.
Therefore, in the drop-down ComboBox, you can only use cbx. text or cbx. selecteditem. tostring () to obtain the value of ComboBox.