一个文本文件,逗号分隔例如:12345678,ASDFGHJ123K
1234567890365,AS1DFGHJK
123451267890,AS123DFGHJK
1234567890,ASDF3154554GHJKOpenDialog1.execute 后要先读取第一行到Edit1.Text和Edit2.Text或者还有以后的Edit3等等当中,另外有两个按钮Button1和Button2分别为“上一条”,“下一条”来改变文本框中显示的内容,在一个Label1中显示“当前条数/总条数”,写了很久都不得其要领,请大家给出完整代码谢谢!!!
1234567890365,AS1DFGHJK
123451267890,AS123DFGHJK
1234567890,ASDF3154554GHJKOpenDialog1.execute 后要先读取第一行到Edit1.Text和Edit2.Text或者还有以后的Edit3等等当中,另外有两个按钮Button1和Button2分别为“上一条”,“下一条”来改变文本框中显示的内容,在一个Label1中显示“当前条数/总条数”,写了很久都不得其要领,请大家给出完整代码谢谢!!!
解决方案 »
- 请朋友将下面5个函数转换成Delphi的写法.谢谢.结贴率100%
- 急求基于delphi的从excel导入SQL数据库的编程应用的实际代码 最好详细点
- 取所有硬盘空间
- 如何取日?
- 关于BDE使用存储过程问题!!!在线!!!这个问题太难了吧!
- 用TMediaPlay播放AVI文件时如何调整可视区的大小?
- 关于listbox的超级菜问题!!
- 我用delphi 做了一个dll文件,vb不能调用,如何做vb能调用的dll?
- 大家来看看这个问题
- 关于Build号的建立问题!
- 正在学习GraphicEx和GifImage的使用,希望使用过的兄弟来说说成功使用的经验和方法。
- 100分问个简单问题(分太多了),关于DBChart中的Series
没有多大区别,你改一下就可以
Type
CarCord=Record
CarNo:String[12];
EndDate:String[12];
CarType:String[6];
CarM:String[12];
JobName:String[30];
Tel:String[14];
PassTime:String[20];
ClassNo:string[4];
end;
Var
CarFile:File of CarCord;
CarData:CarCord;
FName:String;
RecSize,CurRec:Longint;procedure T_DataHZ.showrecord;
begin
cp.Text:=CarData.CarNo;
EndDate.Text:=CarData.EndDate;
CarType.Text:=CarData.CarType;
Cm.Text:=CarData.CarM;
dw.Text:=CarData.JobName;
dh.Text:=CarData.Tel;
PassTime.Text:=CarData.PassTime;
ClassNo.Text:=CarData.ClassNo;
end;
procedure T_DataHZ.ComboBox1Change(Sender: TObject);
Var
Str:String;
begin
Str:=ComboBox1.Text;
if str='01道' then filepath:='CarCord01.dat';
if str='02道' then filepath:='CarCord02.dat';
if str='03道' then filepath:='CarCord03.dat';
if str='04道' then filepath:='CarCord04.dat';
if str='05道' then filepath:='CarCord05.dat';
if str='06道' then filepath:='CarCord06.dat';
if str='07道' then filepath:='CarCord07.dat';
if str='08道' then filepath:='CarCord08.dat';
CurRec:=0;
FName:=filePath;
AssignFile(CarFile,FName);
RecSize:=Sizeof(CarData);
if FileExists(FName) then begin
Reset(CarFile);
if not Eof(CarFile) then
begin
Read(CarFile,CarData);
end;
datahz_ok.Enabled:=true;
seek(CarFile,0);
showRecord;
end else
Application.MessageBox('在本软件的目录下没有这个文件!','系统提示',mb_ok);
end;如果想控制指针就用SEEK例如:seek(CarFile,0);
这是指向第一条的指针。
StrList : TStringList;
begin
StrList := TStringList.Create();
StrList.LoadFromFile('c:\dd.txt');
Label1.Caption := '总数:'+Inttostr(StrList.Count);
ShowOneLineData(StrList.Strings[i]);//写一下这个过程来处理分段显示的问题
.......
end;
procedure Tform1.ShowOneLineData(i:integer);
var
tmp:string;
jpos: integer;
begin
tmp := strList.strings[i];
jpos := pos(',',tmp);
Edit1.text := Copy(tmp,1,jpos -1);
Delete(tmp,1,jpos);
Edit2.text := tmp;
end;
TPayEvent = procedure(ACount: Integer) of object;
type
TPay = Class
PayList: TStringList;
ListName: string;
RecordCount: Integer;
private
FActive: Boolean;
FCount: Integer;
FOnShowInfo: TPayEvent;
procedure SetActive(const Value: Boolean);
procedure SetCount(const Value: Integer);
procedure SetOnShowInfo(const Value: TPayEvent);
private public
property Active: Boolean read FActive write SetActive;
Property Count: Integer read FCount write SetCount;
procedure First;
procedure Prior;
procedure Next;
procedure Last;
procedure Save;
published
property OnShowInfo: TPayEvent read FOnShowInfo write SetOnShowInfo;
end;
{ TPay }procedure TPay.First;
begin
if FActive and (Count >= 1) then
Count := 1
else
Count := Count;
end;procedure TPay.Last;
begin
if FActive and (Count > 0)and(Count < RecordCount) then
Count := PayList.Count
else
Count := Count;
end;procedure TPay.Next;
begin
if FActive and (RecordCount > 0)and(Count < RecordCount) then
Count := Count + 1
else
Count := Count;
end;procedure TPay.Prior;
begin
if FActive and (RecordCount > 0)and(Count > 1) then
Count := Count - 1
else
Count := Count;
end;procedure TPay.Save;
begin
if FActive then
begin
PayList.SaveToFile(ListName);
end;
end;procedure TPay.SetActive(const Value: Boolean);
begin
if (FileExists(ListName))and Value then
begin
PayList := TStringList.Create;
PayList.LoadFromFile(ListName);
RecordCount := PayList.Count;
FActive := Value;
end
else
begin
if not Value then
PayList.Free;
Exit;
end;
end;procedure TPay.SetCount(const Value: Integer);
begin
FCount := Value;
if Assigned(OnShowInfo) then
FOnShowInfo(FCount);
end;procedure TFrmBrowNoLine.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
PayList.Free;
Action := caFree;
end;procedure TPay.SetOnShowInfo(const Value: TPayEvent);
begin
FOnShowInfo := Value;
end;