Example 3. Handling dialogue controls

Top  Previous  Next

By using the script and events of the controls, you can handle controls just like it is done in Visual Studio. We will show by example, how the CheckboxControl can handle the TextBoxControl accessibility.

 

Create a new report and add a dialogue into it. On the dialogue, place the CheckBoxControl and TextBoxControl controls, as shown in the figure below:

 

dialogExample3

 

Now select the CheckBoxControl, open the "Properties" window and click the btn79button. Double click the "CheckedChanged" event, which is fired when changing the status of the checkbox. FastReport will create an empty handler for that event. Write the following code in it:

 

private void CheckBox1_CheckedChanged(object sender, EventArgs e)

{

  TextBox1.Enabled = CheckBox1.Checked;

}

 

If we run the report, we can enable or disable the TextBoxControl by the checkbox.