Olukayode Oluwole
asked on
How do i get a field from a combo box
I have a c# application in which i need to get a field from a combo box.
See a table which i have loaded into a combo . (See table below)
What i want to grab are 2 fields othercurrencycode and exchrate
Below is the script that does the Load and specifies the 2 fields to get
LoginDetails.exDataSource = GlobalConfig.Connection.Ge tExchRate_ All();
glTRANSCurrencyValue.DataS ource = LoginDetails.exDataSource;
glTRANSCurrencyValue.Displ ayMember = "FullCodeName";
glTRANSExchrateValue.DataB indings.Ad d(new System.Windows.Forms.Bindi ng("Text", LoginDetails.exDataSource, "exchrate", true));
glTRANSCurrencyValue.DataB indings.Ad d(new System.Windows.Forms.Bindi ng("Text", LoginDetails.exDataSource, "othercurrencycode", true));
Below is short of the screen that shows the loaded Combo
The screen below shows that the Currency instaed is showing the ValueMember is showing the DisplayValue (see below)
what do i need to specify to get the USD as the code at runtime and not the complete record
Thanks
Oluaky
See a table which i have loaded into a combo . (See table below)
What i want to grab are 2 fields othercurrencycode and exchrate
Below is the script that does the Load and specifies the 2 fields to get
LoginDetails.exDataSource = GlobalConfig.Connection.Ge
glTRANSCurrencyValue.DataS
glTRANSCurrencyValue.Displ
glTRANSExchrateValue.DataB
glTRANSCurrencyValue.DataB
Below is short of the screen that shows the loaded Combo
The screen below shows that the Currency instaed is showing the ValueMember is showing the DisplayValue (see below)
what do i need to specify to get the USD as the code at runtime and not the complete record
Thanks
Oluaky
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Got it
If glTRANSCurrencyValue is your combobox id..
You are setting glTRANSCurrencyValue
DisplayMember,.. similarly
try setting the currency code column result to
glTRANSCurrencyValue.Value