我用edit1录入数据回车在一个列表中显示出来,用什么控件,不连接数据库的控件,录入一个数字回车就是是一行,用一个传输过来的变量制控制录入的数据个数据,并且不能重复。和在这个数量控制之内的录入数据不能重复。例如手机号码的录入,具体格式乳腺
                             录入
                          edit1录入框
                        列表:1、录入数据1;
                              2、录入数据2;
                              3、录入数据3;
                                     .
                                     .
                                     .
                                     .
                    从别的窗体串个变量控制录入的数据量
               谢谢,我给120分。我要代码,如果能够实现,马上结贴。快点。马上结

解决方案 »

  1.   

    用StringGrid1:
    初始为:
    object StringGrid1: TStringGrid
        Left = 168
        Top = 96
        Width = 129
        Height = 201
        ColCount = 1
        FixedCols = 0
        RowCount = 1
        FixedRows = 0
        TabOrder = 1
      end 
    procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
    begin
      if key=char(13) then
        begin
          StringGrid1.Rows[StringGrid1.RowCount-1].Text:=edit1.Text;
          StringGrid1.RowCount:=StringGrid1.RowCount+1;
        end
    end;
      

  2.   

    procedure TFomr1.Edit1.KeyPress(...)
    begin
      if Key=#13 then
      begin
        if Edit1.Text<>'' then
        begin
          if ListBox1.Items.IndexOf(Edit1.Text)=0 then
            ListBox1.Items.Add(IntToStr(ListBox1.Items.Count+1)+'、'+Edit1.Text);
        end;
      end;
    end;
      

  3.   

    procedure TForm1.Edit1KeyDown(...); // Edit1 的 OnKeyDown 事件中
    begin
       if (Key = VK_RETURN) and (ListBox1.Items.IndexOf(Edit1.Text) = -1) then
          ListBox1.Items.Add(Edit1.Text);
    end;