I'm designing a C# application where I have a groupbox showing OS and RAM related information. I designed it using the controls - labels put together in a Groupbox showing RAM related information.
I have a Refresh button which when clicking should display % of RAM used currently.
For this, I need the label (and also few other labels) inside the groupbox to refresh and re-compute the value.
How do i do this? I tried all below in the RefreshButton_Click event but nothing works:
label1.Refresh();
GroupBox1.Refresh();
Form1.Refresh();
Form1.Invalidate(true);
Panel1.Refresh();
Pls help in this as I do not think reloading an entire form would an efficient solution.
Refreshing won't do anything but display the same assigned value. You must set the new calculated values to your controls inside your RefreshButton_Click handler:
var myNewValue = CalculateNewValue();
label1.Text = myNewValue;
Hope it helps!