ItemChanged event

I have to dropdown data windows boxes emp no and emp name
I want to select or type emp no and when I have selected or tab out I want
the emp name displayed in the drop down datawindow. Please send me code to do this I have
got the data retrieve ok just having probs with setItem , i guess I need some instance variables
set up
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

raheisAuthor Commented:
sorry in the Qustion area
Use lokkupdisplay () in computed field to display Emp Name (if emp-no field has dropdown dw. )
SOrry lookupdisplay() function.
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Declare an instance variable for your datawindowchild:
datawindowchild      idwc_artist

In the PFC_PREOPEN (or OPEN if you're not using PFC) event define the variable:
dw_header.GetChild('artist', idwc_artist)

Make sure that the dropdown datawindow includes the column with the data you want. If you do not want it to display in the dropdown, you can delete it from the display but you must select it in the query.

Then in the ITEMCHANGED event do something like this:
int            li_data
long            ll_row
string      ls_column, ls_display, ls_msgParms[]

ls_column = dwo.Name

Choose Case ls_column
      Case 'artist'
            ll_row = idwc_artist.GetRow()
            ls_display = idwc_artist.GetItemString(ll_row, 'artist_name')
            this.SetItem(row, 'artist_name', ls_display)
raheisAuthor Commented:
Hello Mark,

I think your in the going in the right direction but I got 2 dropdowns
Empid : 123               Emp Name : Smith

When I select 123 in the first dropdown I want to set the second drop down to smith and be able to either type 123 in editable dropdown or just select it.

Why do you need the description field to be a dropdown? Can a user select the name rather than the ID? If the second field is intended as display only, create a computed field in your main datawindow select that you can use to hold the description and drop the other dropdown. If you need for your users to be able to select in either field, you would need to create 2 dropdownchild instance variables, get the value selected in the one changing and FIND the equivalent value in the other dropdown and sroll to it. You would have to be careful with such a double update process to recognize when the other record was already at the correct value to avoid creating an infinite loop in itemchanged.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
raheisAuthor Commented:
yes I definitely need 2 dropdowns and that is where i need some code snippet because Im having trouble setting the second one
raheisAuthor Commented:
Thanks, I used an instance variable set in item changed and used itemfocuschanged to get and set the other dddw it works.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.