Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Kulwant Singh
  Where is Kulwant Singh?
 Shimla
 India
 Kulwant Singh
 To: Cecil Champenois
  Where is Cecil Champenois?
 Little Elm
 Texas - United States
 Cecil Champenois
 Tags
Subject: RE: Binding a field to a DropDown List
Thread ID: 248759 Message ID: 248762 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Wednesday, December 23, 2009 4:50:48 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 ;
> ORDER BY ID ;
> INTO ARRAY .aMills
>

>
> Cecil Champenois, Jr.

Sir,

You can select an Sql statement instead.
Make the row source type 3 (ie Sql statement)

IN The rowsource put..
Select alltrim(name), id from mills order by id into cursor listcur



you do not need to add "|" as a separator. You can set column lines = .t. instead.
You can set coulmn widths like.... 250, 50 (ie 250 for the Name and 50 for the ID)




kulwant
(Help Save the TIGER. Save Wildlife. Live & let Live)

ENTIRE THREAD

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