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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi! how to replace a fieldvalue wi

Status
Not open for further replies.

ahmed1973

Programmer
Jan 29, 2013
42
DZ
Hi!
how to replace a fieldvalue with a selected items of a listbox in foxpro
 
Due to the similarity of your question I will ask - Is this a different question than your previous one?
how to move a value of a cells in a
thread184-1703515


Or are you just trying to approach your previous question by using a different method?

Good Luck,
JRB-Bldr
 
The value of the selected item in a listbox is contained in its Value property. So, to replace a field (in a table) with that value, you do something like this:

SELECT TheTable
REPLACE TheField WITH THISFORM.List1.Value

I'm assuming there is only one column in the listbox. Is that right?

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
The short variant is to set the listbox controlsource to the field you want to set to the selected item additional to setting the rowsource and rowsourcetype to the list of items to choose from. That does not need any code.

In Short: If your listbox already displays items, you most probably only need to set the controlsource to TheTable.TheField you want to be set to the chosen value. Then set BoundTo = .T. and in case of a multi column listbox specify which column to copy into the controlsource field via BoundColumn number.

You should look at some basic sample code in the solution samples coming with VFP. Start the Task Pane from the Tools menu. In it's toolbar you'll find "Solution Samples". You can either search with key words in sample descriptions, or brows by category via the treeview. In caase you need to learn about a certain control, I'd expand the "Controls" nodee and in this case the subnode "Listbox", where you find several samples.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top