|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I am using the OpenDiag component to open a file, but after open a file i want to read the contents of that file into my Memo field... How can i do this? |
|
#2
|
||||
|
||||
|
See the Delphi help >> Text File Routines ... everything you need is there !
Good luck, Silver |
|
#3
|
||||
|
||||
|
Heh, the TStringList object (i.e. Memo.Lines) has a LoadFromFile method. You can use this to read data from a file into a memo. Something like this ought to do the trick:
Code:
if OpenDialog1.Execute then
Memo1.Lines.LoadFromFile(OpenDialog1.Filename);
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month |
|
#4
|
|||
|
|||
|
it depends how you want to read it?
is it just normal text/ comma, comma delimated, tab data? |
|
#5
|
|||
|
|||
|
Its just a normal text file, i also came cross thse 2 ways of doingit:
QueryInput.Lines.LoadFromFile(OpenDialog1.FileName); AND AssignFile(myFile, OpenDialog1.FileName); Reset(myFile); while not Eof(myFile) do begin ReadLn(myFile, querytext); QueryInput.Lines.Add(querytext); end; |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Delphi Programming > Reading content of a text file.... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|