hey im in yr12 and trying to do an assignment anyway i want to b able to press a radio button and for saved words to load from a file its a hangman game im just unsure how to how to load the words from file when clicking the radio button. Can anyone help me out with some code?
thanks heaps

hey im in yr12 and trying to do an assignment anyway i want to b able to press a radio button and for saved words to load from a file its a hangman game im just unsure how to how to load the words from file when clicking the radio button. Can anyone help me out with some code?
thanks heaps

12 years? man, you should live your childhood, you have enough time to code, but this isn't my business.

a button, respond to click with the onclick event, and the code located there is runned.

below you will find a piece of code which will resolve your job:

f: TextFile; // a text file
s: string;
begin
AssignFile(f, ‘foo.txt’);
Reset(f);
while not EOF(f) do begin
readln(f, S);
writeln(S);
end;
CloseFile(f);
end.

try to understand the code.

best regards,

hey thanks heaps umm ok this is wat i've got now but it still doesn't work can u help?


type
Words = record
easywords: string [20];
mediumwords: string [20];
difficultwords: string [20];
end;
var WordFile: file of words;
procedure TLevelForm.EasyBtnClick(Sender: TObject);
var Easywords: string;
Wordfile: string;
begin
AssignFile (wordfile, 'EasyWords.txt');
reset (wordfile);
while not eof (wordfile) do
begin
Read (Easywords, 'wordfile');
Write (wordfile);
end;
CloseFile (Easy);

thanks heaps

posting twice a problem doesn't help neither you or us...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.