The variable folder is just a bool variable. When I debug my code I can see that it runs as it should, but still the button's Text doesn't change.
I don't know if it has anything to do with the problem, but I have a FileLListbox and a FolderListBox from Alva on the form. Should that be the problem.
Try something quick: Put a breakpoint on the if line of the handler, and change teh button text in the designer to "TEST".
Run your app, and press the button. Look at btn.Text in the debugger - is it "TEST"?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
Put a breakpoint in your code in this routine. Search through your code for all instances of the word Test and put breakpoints on them all - each and everyone. Run the program again and note each breakpoint you hit - you must be resetting the text back to Test after you have left this routine.
Trying that statement shouldn't even compile. Assuming you didn't complete the statement you really used (with a semi-colon,) this will normally cause the button to refresh and show "Hi" (Without quotes) like your other responder said.
You can try to force a refresh with an .Invalidate
Once, I tried to execute complex logic and print intermediate results by modifying text boxes' .Text property. Wanted to know why that wasn't working. Your winapp has to be idle and waiting for a response before it will render the changes.
I fixed that by assigning a delegate in the winapp, running the calculations on another thread and calling the delegate.
If by "custom controls" you mean UserControls in WinForms, I have benefited greatly from Matthew MacDonald's excellent book "Pro .NET 2.0 Windows Forms and Custom Controls in C#"[^].
Yes, that's quite an old book now (2004), but the author goes into many details, such as defining custom design-time adornments, and complex Property Browser selection mechanisms for custom controls, in a way that I have found clearer than any material I have read since.
"Science is facts; just as houses are made of stones: so, is science made of facts. But, a pile of stones is not a house, and a collection of facts is not, necessarily, science." Henri Poincare
Assuming that you have detailed your requirements correctly, and that you can't use a list (for example), you could do it like this (in pseudocode):
declare array of size n
for count = 0, count less than n
create a new instance of button
set the text of the button
add it to the parent control collection (where parent could be a form, a panel, or the like)