Page 2 of 2
Re: Canceling a forms OK button
Posted: Wed Jun 24, 2015 2:04 pm
by Jennypi
Thanks but it's not working. The code "this.IsStopped = true;" doesn't stop the report rendering.
Any other idea?

Thank you.
Re: Canceling a forms OK button
Posted: Wed Jun 24, 2015 7:05 pm
by Jan
Hello,
Sorry for troubles with our product!
Usually to stop report rendering you can use IsStopped property of the report, but not in this case. So the correct answer:
Set the DialogResult property of the OK Button to None. After then in ClickEvent of the button right following code:
Code: Select all
if (resultFine) Form1.DialogResult = DialogResult.OK;
Form1.Close();
If you need continue report rendering you set result of the form to OK, otherwise to None.
In attachment you can find sample report.
Thank you.
Re: Canceling a forms OK button
Posted: Mon Jun 29, 2015 9:15 am
by Jennypi
Working great!
Thank you Jan for your help!
Re: Canceling a forms OK button
Posted: Mon Jun 29, 2015 10:10 am
by Alex K.
Hello,
We are always glad to help you!
Let us know if you need any additional help.
Thank you.
Re: Canceling a forms OK button
Posted: Fri Jan 08, 2016 3:00 pm
by Jennypi
Hi
I'm back on this topic as I realize that the code I had written does work properly.
Could you please try to reproduce the problem with the attached example ?
1st situation:
- in the form, type a number
- and click OK
> the report is well displayed.
2nd situation
- in the form, click OK > you get the error message "please enter the first sample number"
- click OK in the error message and enter a number
- click OK in the form
> the report is empty
What is wrong with the OK button code?
Thanks for your help!
Re: Canceling a forms OK button
Posted: Mon Jan 11, 2016 12:03 pm
by Alex K.
Hello,
Please try to use the following code:
Code: Select all
this.IsStopped = false;
if (TextBoxControl1.Control.Text=="")
{
MessageBox.Show("Please enter the first sample number");
this.IsStopped = true;
}
else
{
Form1.DialogResult = DialogResult.OK;
labels.Connect();
Form1.Close();
}
Thank you.
Re: Canceling a forms OK button
Posted: Mon Jan 11, 2016 12:52 pm
by Jennypi
Working perfectly, thanky you!
Re: Canceling a forms OK button
Posted: Mon Jan 11, 2016 12:53 pm
by Alex K.
Hello,
We are always glad to help you!
Thank you.