fj13 0 Posted July 2, 2020 Hello! I'm new to Delphi and to programming in general I have a hard time realizing my idea. Maybe somebody here can help me.. I've a list of numbers, I've already imported into Delphi. Now I want to loop thru them and determine if the number is </> than 5. If smaller than 'Micro', if bigger than 'Macro' should be displayed beside the number. I'm stuck here! At the end it would be cool to count the total number of Macro and Micro, but I think I'm able to do that. I would really appreciate some help! Thanks! Share this post Link to post
Der schöne Günther 316 Posted July 2, 2020 (edited) You're making it unnecessarily hard for you if you rely on interface elements (like the TMemo) for data storage and processing. I guess the button "Read data" gets the numbers from the memo and then keeps them in an array or list? If yes, that's good, because it's probably the hardest part. Because if you have your numbers in a list or an array, you can then easily loop over them with a for statement. If you have some code (especially what is behind your "read data") then we could help with advice tailored to your project, instead of general recommendations. Edited July 2, 2020 by Der schöne Günther Share this post Link to post
fj13 0 Posted July 2, 2020 Sorry of course! I'm reading the data from a txt.file, because then it will be easier to read already existing new data. At least that's my plan. I hope that helps to understand. Share this post Link to post
Skullcode 0 Posted July 2, 2020 You should use the code blocks and insert the code within the forum, posting screen shots of the code wont help You should think twice before using TMEMO as a list handler You can create an object that holds your preferred variables and add the object to a list and use it accordingly Share this post Link to post
haentschman 92 Posted July 5, 2020 (edited) Hi all... Quote You should think twice before using TMEMO as a list handler Proposal: 1. create a TStringList as a private variable 2. read the *.txt file into a TStringlist http://docwiki.embarcadero.com/Libraries/Seattle/en/System.Classes.TStrings.LoadFromFile List.LoadFromFile 3. show the content of the *.txt File in the MEMO Memo.Text := List.Text 4. iterate through the lines of the List if you want to Work with the data for I := 0 to List.Count - 1 do begin // your work end; 5. if you change the data in the list, reload the MEMO Memo.Text := List.Text ...finish. German names? If you search the german DP ... https://www.delphipraxis.net Edited July 5, 2020 by haentschman Share this post Link to post