I am making a trace dialog that outputs trace level, location in code and a custom message. It consists of a listbox and some checkboxes:
When a checkbox is unchecked items with that trace level should not be displayed in the listbox:
(The abnormal trace is removed in the above picture)
My problem is that it also removes every item that comes after the removed item (in the above case the removed trace was already last so the bug is not noticed). Unchecking debug removes the error and abnormal trace aswell:
Which is unwanted. Only the debug trace should be removed.
What i do in the code is pretty simple right now: When the value of a checkbox is changed i clear the listbox and populate it again based on the value of the checkboxes. So if for example the trace level is info but that checkbox is unchecked that item won't be appended to the listbox:
I am pretty confident that the logic in the loop is OK but i am not 100%. Any help is appretiated.