Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set a field value on a form

Status
Not open for further replies.

Saturn57

Programmer
Aug 30, 2007
275
0
0
CA
I have a form that I would like to set a field value on based on the input from another field value. I would like to look up a value in a table based on a value already inputted in the form and have that lookup value automatically show in another form field.
 
hi,
are you in dialog box and you are speking of edit control?

Suppose yes; you have a control call it MASTER and another
call it SLAVE.

Define for them CString Member Variable, call them cMaster and cSlave

In the Master you have to check the value: you can do it when you leave it (by tab or mouse) or while the value is changing: in 1st case define in message map, the event
EN_KILLFOCUS, in te 2nd EN_CHANGE. In the routine you define
associated with this event, call the UpdateData( TRUE ):
this will update the variable cMaster.
Always in this routine, do your consideration, build the
cSlave variable and call the UpdateData( FALSE ):
this will update all controls and then also SLAVE.

If you don't wont define Member variables, use system call
SetWindowText and GetWindowText together with GetDlgItem.

ciao
vittorio



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top