设为首页 加入收藏 网站搜索 繁體中文 中国建站网 — 站长资源平台

类似Access查找中的记忆功能

来源网络收集 作者:佚名 时间:2007-4-26 5:09:54 该文得分0

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;

相关文章
广告赞助
网友评论

共有 0 位网友发表了评论,平均得分: 0 查看完整内容

用户名:

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

(注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码