We help IT Professionals succeed at work.
Get Started

How do i get a field from a combo box

Olukayode Oluwole
Last Modified: 2020-03-02
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)

Loaded Table with Data
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.GetExchRate_All();
  glTRANSCurrencyValue.DataSource = LoginDetails.exDataSource;
  glTRANSCurrencyValue.DisplayMember = "FullCodeName";
  glTRANSExchrateValue.DataBindings.Add(new System.Windows.Forms.Binding("Text", LoginDetails.exDataSource, "exchrate", true));
  glTRANSCurrencyValue.DataBindings.Add(new System.Windows.Forms.Binding("Text", LoginDetails.exDataSource, "othercurrencycode", true));

Below is short of the screen that shows the loaded Combo

Combo Load Display
The screen below shows that the Currency instaed is showing the ValueMember is showing the DisplayValue (see below)

Currecycode value showing display member instead of Valuemember
what do i need to specify to get the USD  as the code at runtime and not the complete record


Watch Question
Microsoft Dynamics CRM Consultant
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE