Solved

text file

Posted on 2003-11-04
3
151 Views
Last Modified: 2011-09-20
I have a combobox with some names
a button below
i want when i select a name from combo and push the button
to create me in C:\Temp a new empty text file with the name from the combo
ex if the selected name is John Mark create C:\Temp\John Mark.txt
Thanks
0
Comment
Question by:tinti
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
rvicentiu earned 35 total points
ID: 9679934
it's easy...

procedure TForm1.Button1Click(Sender: TObject);
begin
  with TFileStream.Create('C:\TEMP\'+Combobox1.Items[Combobox1.ItemIndex]+'.txt', fmCreate) do Free;
end;
0
 
LVL 3

Expert Comment

by:ThoseBug
ID: 9680770
procedure TForm1.Button1Click(Sender: TObject);
var
  FileHandle: Integer;
begin
  FileHandle := FileCreate('c:\temp\'+combobox1.text);
  if FileHandle<0 then showmessage('create file error')
end;
0
 
LVL 3

Expert Comment

by:ThoseBug
ID: 9680790
//uupps  add '.txt'

procedure TForm1.Button1Click(Sender: TObject);
var
  FileHandle: Integer;
begin
  FileHandle := FileCreate('c:\temp\'+combobox1.text+'.txt');
  if FileHandle<0 then showmessage('create file error')
end;
end.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question