新建模块:面板(代码):
object FormNewRecord: TFormNewRecord
  Left = 412
  Top = 241
  Width = 269
  Height = 209
  Caption = '新建记录'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object GroupBox1: TGroupBox
    Left = 0
    Top = 0
    Width = 261
    Height = 145
    Align = alTop
    Caption = '请输入:'
    TabOrder = 0
    object Label1: TLabel
      Left = 24
      Top = 32
      Width = 60
      Height = 13
      Caption = '产品编号:'
    end
    object Label2: TLabel
      Left = 24
      Top = 70
      Width = 60
      Height = 13
      Caption = '产品名称:'
    end
    object Label3: TLabel
      Left = 24
      Top = 108
      Width = 48
      Height = 13
      Caption = '存货量:'
    end
    object Label4: TLabel
      Left = 232
      Top = 108
      Width = 12
      Height = 13
      Caption = '件'
    end
    object Edit1: TEdit
      Left = 96
      Top = 28
      Width = 150
      Height = 21
      ImeName = '中文 (简体) - 智能 ABC'
      TabOrder = 0
      OnKeyPress = Edit1KeyPress
    end
    object Edit3: TEdit
      Left = 96
      Top = 104
      Width = 130
      Height = 21
      ImeMode = imClose
      ImeName = '中文 (简体) - 智能 ABC'
      TabOrder = 1
    end
    object Edit2: TEdit
      Left = 96
      Top = 66
      Width = 150
      Height = 21
      ImeName = '中文 (简体) - 智能 ABC'
      TabOrder = 2
    end
  end
  object BitBtn1: TBitBtn
    Left = 88
    Top = 152
    Width = 75
    Height = 25
    Caption = '确定'
    TabOrder = 1
  end
  object BitBtn2: TBitBtn
    Left = 176
    Top = 152
    Width = 75
    Height = 25
    Caption = '取消'
    TabOrder = 2
  end
end新建模块的实现:unit NewRecordForm:
unit NewRecordForm;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, VariableUnit;type
  TFormNewRecord = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Label3: TLabel;
    Edit3: TEdit;
    Label4: TLabel;
    Edit2: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    procedure Edit1KeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  FormNewRecord: TFormNewRecord;implementationuses MainForm;{$R *.dfm}procedure TFormNewRecord.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  if(not(key in['0'..'9']))and(key<>#8)and(key<>#13) then
     begin
        key:=#0;
        showmessage('请输入数字!');
        if key=#13 then
        begin
           if length(edit1.Text)=0 then
           begin
           edit1.SetFocus;
           showmessage('请输入编号!');
           end
           else begin
           edit2.SetFocus;
           VariableUnit.bh:=strtoint(edit1.Text);
//我写的,恐有错,我定义编号和库存只能是数字integer,名称类型为string,各位觉得不妥可更正
           end;
        end;
     end
  else begin      end;  exit;end;end.查询模块:面板
object FormDemand: TFormDemand
  Left = 415
  Top = 237
  Width = 251
  Height = 164
  Caption = '查询记录'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object GroupBox1: TGroupBox
    Left = 0
    Top = 0
    Width = 243
    Height = 97
    Align = alTop
    Caption = '请选择查询方式:'
    TabOrder = 0
    object Label1: TLabel
      Left = 24
      Top = 64
      Width = 3
      Height = 13
    end
    object RadioButton1: TRadioButton
      Left = 8
      Top = 24
      Width = 65
      Height = 17
      Caption = '按编号'
      TabOrder = 0
    end
    object RadioButton2: TRadioButton
      Left = 72
      Top = 24
      Width = 65
      Height = 17
      Caption = '按名称'
      TabOrder = 1
    end
    object Edit1: TEdit
      Left = 84
      Top = 60
      Width = 121
      Height = 21
      ImeName = '中文 (简体) - 智能 ABC'
      TabOrder = 2
    end
  end
  object BitBtn1: TBitBtn
    Left = 64
    Top = 104
    Width = 75
    Height = 25
    Caption = '确定'
    TabOrder = 1
  end
  object BitBtn2: TBitBtn
    Left = 152
    Top = 104
    Width = 75
    Height = 25
    Caption = '取消'
    TabOrder = 2
  end
end查询模块:实现UNIT
unit DemandForm;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons;type
  TFormDemand = class(TForm)
    GroupBox1: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    Edit1: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Label1: TLabel;  
//注:我把LABEL1的TEXT设置为空,当选择RADIO按钮则把它更改为:编号/名称
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  FormDemand: TFormDemand;implementationuses MainForm;
{$R *.dfm}end.

解决方案 »

  1.   

    小程序—库存管理系统:用listview实现增加删除修改数据并保存数据到目录save.ini文档问题(100分)=====之一 
    http://community.csdn.net/Expert/topic/3868/3868621.xml?temp=.857937小程序—库存管理系统:用listview实现增加删除修改数据并保存数据到目录save.ini文档问题(100分)=====之二
    http://community.csdn.net/Expert/topic/3868/3868627.xml?temp=.3478205小程序—库存管理系统:用listview实现增加删除修改数据并保存数据到目录save.ini文档问题(100分)=====之三
    http://community.csdn.net/Expert/topic/3868/3868632.xml?temp=.5440485老说帖子提前太频繁,郁闷。
    谁帮忙啊