I use the same code to fill a control in my WinForms over and over again, so I figured: Hey, you should make it a method instead of copy-pasting it!
So, I created this in my Main
class
Main
internal static void FillWithStuff(RichTextBox box)
{
Data data = GetSomeData("doesn't matter");
foreach (Row row in data)
{
box.Text += row.ToString() + "\r\n";
}
}
WinForm
internal RichTextBox textBox = new RichTextBox();
// Some code
Main.FillWithStuff(textBox);
So, the method executes without exceptions or warnings, but the data is not filled in the box. I checked if the data was loaded and it is, so the problem has to be somewhere else.
How should I implement this correctly?