Forum: Pascal and Delphi Oct 19th, 2009 |
| Replies: 1 Views: 449 For an empty line you can use Memo1.Lines.Add('').
Line 3 and 4 should use this method too, because they are strings. Lines 1 and 2 add a TStrings object (a collection of strings). |
Forum: Pascal and Delphi Oct 12th, 2009 |
| Replies: 4 Views: 465 Try it on paper. Write the values down. Then change them as you walk through each loop (in your head). |
Forum: Pascal and Delphi Oct 12th, 2009 |
| Replies: 4 Views: 465 The way I read this, is that you need to calculate the value of the variable (evens). Just follow the source code in your head, or on paper, and do as it instructs.
I don't see output in the... |
Forum: Pascal and Delphi Sep 17th, 2009 |
| Replies: 5 Views: 608 Is it required to see those lines as they are generated. If you could send them to a file, you can speed it up. The memo is really awful for this amount of data.
Also, the processmessages slows... |
Forum: Pascal and Delphi Aug 3rd, 2009 |
| Replies: 12 Views: 920 Correct. Labels must start with a character, not a number. Add a prefix to the 200, like:
label200:
and change the references in the code. |
Forum: Pascal and Delphi Aug 3rd, 2009 |
| Replies: 12 Views: 920 end . should be end. (remove the space)
Not sure about the first error. Could it be triggered by the $N switch error ? Look for {$N} and remove it (at the top). |
Forum: Pascal and Delphi Mar 24th, 2009 |
| Replies: 3 Views: 374 var
sl: TStringList;
begin
sl := TStringList.Create;
sl.LoadFromFile(yourtextfilehere.txt);
ShowMessage(sl[Random(sl.Count)]);
sl.Free;
end; |
Forum: Pascal and Delphi Mar 24th, 2009 |
| Replies: 3 Views: 374 If you load your strings into a tstringlist, then you can use the random function to select a random line. |
Forum: Pascal and Delphi Mar 24th, 2009 |
| Replies: 3 Views: 478 Show what you have so far. |
Forum: Pascal and Delphi Mar 24th, 2009 |
| Replies: 8 Views: 400 What do you have so far ? |
Forum: Pascal and Delphi Mar 13th, 2009 |
| Replies: 10 Views: 1,373 Ofcourse. Just declare one integer, call randomize and then random. |
Forum: Pascal and Delphi Mar 13th, 2009 |
| Replies: 10 Views: 1,373 const
myarray: array [0..9] of Integer = (10, 20, 30, 40, 50, 60, 70, 80, 90, 100);
begin
Randomize;
Writeln(myarray[Random(10)]);
end; |
Forum: Pascal and Delphi Mar 1st, 2009 |
| Replies: 10 Views: 922 What have you got so far ? A normal windows application or a console application ?
If you have the former, then you can put a label, button and editbox on a form and start from there. |
Forum: Pascal and Delphi Feb 28th, 2009 |
| Replies: 10 Views: 922 What is the problem ? The pseudo code is as it should be. You only have to replace it with actual statements. |
Forum: Pascal and Delphi Sep 26th, 2008 |
| Replies: 2 Views: 1,113 The string (Directory) in the record is causing your problem. You'll need to change it to e.g. string[30]. string may not appear in a typed file, since it's length is undetermined. |
Forum: Pascal and Delphi Aug 5th, 2008 |
| Replies: 7 Views: 1,116 In the OnClick event there's Sender. That refers to the clicked button, so you can use
TButton(Self).Color := clYellow; |