当前位置:主页>Delphi教程>文章内容
类似Access查找中的记忆功能
来源: 作者: 发布时间:2007-04-29  

procedure TComLocateFrm.LocateBtnClick(Sender: TObject);
var
   setLoOptions : TLocateOptions;
   i : integer;
   slKeys : TStrings;
begin
  if ComboBox1.Items.IndexOf(ComboBox1.Text)<0 then
  try
    slKeys := TStringList.Create;
    slKeys.AddStrings(ComboBox1.Items);
    ComboBox1.Items.Clear;
    ComboBox1.Items.Add(ComboBox1.Text);
    for i := 0 to 8 do
      if i < slKeys.Count then
        ComboBox1.Items.Add(slKeys.Strings[i]);
  finally
     slKeys.Free;
  end
  else begin
    i := ComboBox1.Items.IndexOf(ComboBox1.Text);
    ComboBox1.Items.Insert(0,ComboBox1.Text);
    ComboBox1.Items.Delete(i+1);
    ComboBox1.ItemIndex := 0;
  end;

  if rdoExactly.Checked then
     setLoOptions := []
  else
     setLoOptions := [loPartialKey];
  if Not DesDataSet.Locate('ZTM', ComboBox1.Text, setLoOptions) then
     MessageBox(Handle, '没有找到符合条件的记录。', '提示', 0+64);
end;


 
上一篇:模拟Nokia手机输入的编辑框   下一篇:200开发技术年度综述之Windows开发
 
  相关文章
·模拟Nokia手机输入的编辑框
·200开发技术年度综述之Windows开发
·Delphi和Office程序开发
·Delphi中使用OLE方法操作Excel
·关于DBGrid的分类颜色显示
·delphi来写你的第一个dll文件,非常简
·使TStringGrid自适应宽度
·将指定字符串后面的'0'字符截去[原创
·如何用Delphi编写自己的可视化控件
·CRC算法的实现
·delphi实现批量缩略图生成工具开发代码
·Delphi中避免使用ClassName判断对象的
 
【关闭窗口】
推荐本站资源
最新文章