RandomRange TMemo Lines
Question
I would pick a random line from Memo1 and then run it as a link, I tried this code:
ShellExecute(Handle, 'open', PAnsiChar(RandomRange(Memo1.Lines[1], Memo1.Lines.Count)), nil, nil, SW_SHOWNORMAL) ;
But an error appears:
Unit1.pas(86): E2010 Incompatible types: 'Integer' and 'string'
So my question is: How do I pick a random line from TMemo?
Thank you.
Solution
Should be
ShellExecute(Handle, 'open', PChar(Memo1.Lines[RandomRange(0, Memo1.Lines.Count-1)]), nil, nil, SW_SHOWNORMAL) ;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow