if not CDS_MBoxBar.Locate('BBarcode',EdtBBarcode.Text,[])then
其中locate括号中的内容分别代表什么?for i := 0 to CBox_Line.Items.Count -1 do
         begin
           if CBox_Line.Items.Strings[i] = AdqPublic2.fieldbyname('Line').AsString then
           begin
             CBox_Line.ItemIndex := i;
             Break;
           end;
         end;
求这段代码注解

解决方案 »

  1.   

    1 这是字段定位2 遍历combobox寻找和Line字段相同的行,然后选中那一行
      

  2.   

    按照EdtBBarcode.Text的值在adoquery的BBarcode字段进行定位,选中那一行记录
      

  3.   

    if not CDS_MBoxBar.Locate('BBarcode',EdtBBarcode.Text,[])then
    其中locate括号中的内容分别代表什么?{在数据集CDS_MBoxBar中搜索BBarcode字段内容等于EdtBBarcode.Text的记录,搜到就返回True,指针并移动到此记录上,否则返回False,指针不动}
    for i := 0 to CBox_Line.Items.Count -1 do {循环CBox_Line每一项,从0开始}  begin
      if CBox_Line.Items.Strings[i] = AdqPublic2.fieldbyname('Line').AsString then {比较,相等就执行下面begin..end中代码,不等就继续循环,直到循环结束}  begin
      CBox_Line.ItemIndex := i;{定位到此项目,即CBox_Line.Text值就是AdqPublic2.fieldbyname('Line').AsString值了}  Break;{跳出循环}
      end;
      end;locate还有其它的功能,还有像这种问题,自己最好先翻翻书,百度百度,调度一下,印象会深点