Link to home
Start Free TrialLog in
Avatar of Olukayode Oluwole
Olukayode OluwoleFlag for Canada

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)

User generated image
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

User generated image
The screen below shows that the Currency instaed is showing the ValueMember is showing the DisplayValue (see below)

User generated image
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
Avatar of Rikin Shah
Rikin Shah
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As in the previous expert comment, not sure how you're using the objects..

If glTRANSCurrencyValue is your combobox id..

You are setting glTRANSCurrencyValue
DisplayMember,.. similarly

 try setting the currency code column result to
glTRANSCurrencyValue.ValueMember
Avatar of Olukayode Oluwole

ASKER

Thanks Got it