作者:白宇2502858015 | 来源:互联网 | 2023-10-17 16:11
ihaveusedthedelphidatabindingwizardwithmyxmlfile,andeverythingcompilesandrunsfine.
i have used the delphi data binding wizard with my xml file, and everything compiles and runs fine.
我已经使用delphi数据绑定向导和我的xml文件,一切都编译并运行正常。
I have 3 comboboxes on my form. Manufacturer, Model and Year.
我的表格上有3个组合框。制造商,型号和年份。
Manufacturer is populated using the following code on FormCreate.
使用FormCreate上的以下代码填充制造商。
procedure TfrmMain.FormCreate(Sender: TObject);
var
RGearing : IXMLracegearingType;
i : Integer;
begin
// Load XML Document into Memory
RGearing := Getracegearing(XMLDocument1);
// Populate Manufacturer combobox
for i := 0 to RGearing.Car.Count-1 do
begin
cbManufac.Items.Add(RGearing.Car[i].Manufacturer);
end;
// Copy current selected Manufacturer to string variable
varManufac := cbManufac.ListItems[(cbManufac.ItemIndex)].Text;
end;
My question is how can i populate the Model combobox based on the current manufacturer that is selected.
我的问题是如何根据所选的当前制造商填充模型组合框。
Here is the XML File that goes with it
这是随附的XML文件
1
Ford
Test 1
2
Ford
Test 2
3
Honda
Test 1
So if the manufacturer selected is Ford then the model combobox needs to display Test 1 and Test 2 as the items.
因此,如果选择的制造商是福特,则模型组合框需要显示测试1和测试2作为项目。
2 个解决方案