The answer for the update to question:
Is there anyone out there who can help me in reading the values from valuemember of combobox. can be as follows:
The
SelectedValue
property of
ComboBox
can be used to obtain the object containing the
value
of the member of the data source specified by the
ValueMember
property as explained here
ListControl.SelectedValue [
^]. Even though it is written here as
Listcontrol
, as
ComboBox class[
^]is derived from
ListControl
it is available on
ComboBox
.
So to get the value
string value = cmbgenric.SelectedValue != null ?
cmbgenric.SelectedValue.ToString() : string.Empty;
Or if the data specified by the
ValueMember
is other than
string
type say
double
type then
double value =Convert.ToDouble(cmbgenric.SelectedValue);
Convert.ToDouble
returns 0 when the
cmbgenric.SelectedValue
is
null
and does not throw exception.