trying to run a function without putting it in the Main() when the program is run.
how do I start the new created function?
trying to call RunMix() in the Main() but get an error because of the lable1
namespace mixer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int i = 0;
public void RunMix()
{
while (i == 0)
{
label1.Text = knob1.Angle.ToString();
Application.DoEvents();
}
}
private void Form1_Load(object sender, EventArgs e)
{
RunMix();
}
}
}
Alright my first answer was completely off the topic because of your mysterious question. Now that you have updated it I have better – not complete – understanding of what do you mean.
Looking at code I guess what you are trying to do is to change the value of label when knob1 control’s angle changes. If knob1 is a control it should have a change event and you should change value of label1 inside knob1_change event handler. If knob1 doesn’t have any event – highly unlikely – then you should use a timer instead. Loop is simply a bad idea in your situation. Timer should work like this
Stop timer when form is closed or use activate/deactivate cycle depending upon your requirement.