このコードは、my ddlb_divisionオブジェクトの "SelectionChanged"イベントにあります。私は2 DDLBの、ddlb_division & ddlb_sectionを持っています。
int li_division_id
int li_section_id
string ls_section
SetPointer(HourGlass!)
//Clears the DDLBs
ddlb_section.Reset()
//Gets the Division ID
li_division_id = integer(Left(this.Text(index), 2))
//Cursor to gather the Sections under the selected Division
declare section cursor for
select section_id, section_name
from tadtp_sections
where division_id = :li_division_id;
//Open cursor
open section;
//Get first row of data
fetch section into :li_section_id, :ls_section;
//Loop while we have rows
do while(SQLCA.SQLCode = 0)
//Adds item to DDLB
ddlb_section.AddItem(string(li_section_id, "00") + " " + Trim(ls_section))
//Gets next row
fetch section into :li_section_id, :ls_section;
loop
//Close cursor
close section;
//Enables controls
ddlb_section.Enabled = true