嘿家伙巨大的DELPHI问题,请帮帮我 [英] Hey guys HUGE DELPHI question, please help me

查看:56
本文介绍了嘿家伙巨大的DELPHI问题,请帮帮我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Richedit同时读取2个文本文件中的数据,我想这样做的原因是我可以将richedit的内容保存在一个单独的目录中(但我必须是明确我的意思是我在同一时间在一个richedit中使用2个文本文件,你知道第一个文本在第一行第二个文本在下一行),我知道你不能这样做,因为它只是试图替换数据同时崩溃程序,请帮我解决这个难题



RDisp是我的richedit



I am trying to use a Richedit to read data from 2 text files at the same time, the reason I want to do this is so that I can then save the content of the richedit in a seperate directory (But I must be clear IT IS IMPERATIVE that I use 2 textfiles in one richedit at the same time, ya know First text is on the first line second text is on the next line), I know you cant do it like this as it would just try to replace the data at the same time thus crashing the program, Please help me solve this conundrum

RDisp is My richedit

var
    sStudent:String;
begin
    sStudent:=CbSearch.Text;
    RDisp.Lines.LoadFromFile('Students\' + sStudent + '.zip');
    RDisp.Lines.LoadFromFile('Levels\' + sStudent + '.zip');
end;





我尝试过:



我没有尝试过多,因为我对delphi很认真,但到目前为止互联网并不是非常有用,因为我想要一个非常具体的结果,谢谢你提供的任何帮助。



What I have tried:

I havent tried much because I am seriously new to delp but the internet thus far isnt very helpful as I want a very specific result, thanks for any help provided.

推荐答案

使用文件流来读取您的数据,然后将数据附加到您的富文本框



Use file stream to read your data and then append the data to your rich text box

procedure TForm1.Button1Click(Sender: TObject);
var
  FileStream: TFileStream;
  data: TStringList;
begin
  data := TStringList.Create;
  RichEdit1.Clear;
  data.LoadFromFile('D:\aa.txt');
  RichEdit1.Lines.Append(data.Text);

  data.LoadFromFile('D:\bb.txt');
  RichEdit1.Lines.Append(data.Text);


这篇关于嘿家伙巨大的DELPHI问题,请帮帮我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆