Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cecil Champenois
  Where is Cecil Champenois?
 Little Elm
 Texas - United States
 Cecil Champenois
Subject: Binding a field to a DropDown List
Thread ID: 248759 Message ID: 248759 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Wednesday, December 23, 2009 2:21:05 AM         

I have normally set up a dropdown list box by making an array from a picklist table. I liek thsi way fo doign it. But, I am a little confused as to how you bind that DropDown List to the specific data that the user selects from the list, or maybe my question is how does this work? Iv'e got it workign on several forms, but when I tried to implement it on another form, it doesn't seem to be bound to the data.

Here's what I have set in the Properties of the DropDown List box: (This one works just fine)

The name of the control is cboMill.

BoundColumn = 2
BoundTo = .T.
RowSource = ThisForm.aMills
RowSourceType = 5 (Array)
Style = 2 (DropDown List)

In the Control's INIT:
cboMill = "This.ListIndex = 1"

In the FORM's INIT:
ThisForm.cboMill.ControlSource="Certs.Mill_ID" <<--- (This is what I think I forgot to add.)

I sometimes wonder why we cannot set the SourceControl on the DropDownList object? Why is it that we have to set thsi manually in the FORM"s INIT, rather than in the control itself? Or, am I mistaken?

The following is the code which creates the array from the MILLS table.

SELECT ID + "|" + ALLTRIM(Name), ID ;
FROM Mills ;

Cecil Champenois, Jr.


Binding a field to a DropDown List Posted by Cecil Champenois @ 12/23/2009 2:21:05 AM
RE: Binding a field to a DropDown List Posted by kulwant singh @ 12/23/2009 4:50:48 AM
RE: Binding a field to a DropDown List Posted by Stefan Wuebbe @ 12/23/2009 10:22:32 AM