Hi, I just made this code, but it doesn't really work ok.
First it loads a random line from the text file names.txt, then load a random picture from the dir 'C:\Programs\picture\mobs\', but, before I added the load picture code, the random line load worked ok. Now when it loads both picture and text, it only chooses random letters in a line. if it's supposed to choose between 'Adam' and 'Eve', it might only take 'am' or 've'.
Could anyone look into this and see what I might've done wrong? Thanks /Ante
Code:
Memo2.Lines.LoadFromFile(ExtractFilePath(ParamStr(0))+'names.txt');
MonName.Caption := Memo2.Lines.Strings[Random(75)];
FileListBox1.Directory := ExtractFilePath(ParamStr(0))+'\pictures\mobs\';
ListBox1.Items := FileListBox1.Items;
MonPic.Picture.LoadFromFile(ListBox1.Items.Strings[Random(5)]);
Could anyone look into this and see what I might've done wrong? Thanks /Ante