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

Populating the list box control 1

Status
Not open for further replies.

mfreeze

Programmer
Sep 11, 2003
16
0
0
US
How would you populate the list box control or a drop-down menu with the names of the fields on your active table? I want the users to open a dBase file, then choose one field from that database from a list, then I will perform several operations on that field.

Any help will be appreciated.

Thanks,
Mark.
mfreeze@mailent.com
 
mfreeze

Here is one way to do it.

Code:
PUBLIC oform1
USE c:\suncsc_local\suncsc\data\suntel\arbatch.dbf SHARED &&Replace with YOUR Table
PUBLIC a_fields[1]
AFIELDS(a_fields,"arbatch")
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	ADD OBJECT list1 AS listbox WITH ;
		ColumnCount = 1, ;
		RowSourceType = 5, ;
		RowSource = "a_fields", ;
		FirstElement = 1, ;
		Height = 169, ;
		Left = 72, ;
		NumberOfElements = (ALEN(a_fields)), ;
		Top = 36, ;
		Width = 229, ;
		Name = "List1"
ENDDEFINE

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top