I am new to c++ windows form programming. I have designed a windows form which has 5 buttons and 5 graphs. When any buttom is pressed 100 random values are ploted in the respective graph. Everything is working perfectly except when the values are being plotted no other button works. I have created a for loop which loops 100 times and plots the randomly generated values in the respecive graph. But while one graph is being plotted no ther button work. I actully wanna create a start and stop button so when the start buttom is pressed the plotting starts and when stop is pressed the plotting stops. Thanks in advance.
the code for the button is as follows
private: System::Void btn1_Click(System::Object^ sender, System::EventArgs^ e) {
for (z = 0; z < 100; z++)
{
y = rand() % 8 + 1;
x = rangeMax;
//plot data
gp1->PlotXY(x, y, 0);
//display lable
dis1->Text = Convert::ToString(y);
dis1->Update();
ctr++;
Sleep(1);
if (ctr == 1)
{
rangeMin = rangeMin + 0.2;
rangeMax = rangeMax + 0.2;
gp1->SetRange(rangeMin, rangeMax, 0, 10);
gp1->XGridNumber::set(100);
gp1->YGridNumber::set(10);
ctr = 0;
}
gp1->Update();
}