GrapeCity MultiRow Windows Forms Documentation
Notification using Sound (SoundNotify)

You can use SoundNotify to notify the user of a validation error using a sound. This generated sound can be any of the following system sounds. In addition, you can use the SoundNotify.SoundLocation property to notify of a validation error by using a specified sound.

  • If the value of the SoundNotify.SoundLocation property is empty, the sound set in the SoundNotify.SoundType property is used.
  • Only a .wav file can be used for the SoundNotify.SoundLocation property.
  • If the file specified in SoundNotify.SoundLocation property does not exist, the sound is not played.

Using Designer

Complete the following steps to use SoundNotify for cell validation.

  1. Select a cell for which to validate the value (for example, textBoxCell1).
  2. From the Properties window, select the Validators property and click the ... button.
  3. From the displayed CellValidator collection editor, select RequiredFieldValidator from the top-left combo box and click the Add button.
  4. Select the Actions property from the property grid at the right of the screen and click the ... button.
  5. Add SoundNotify in the displayed CellValidateAction collection editor.
  6. Click the OK button and close the CellValidateAction collection editor.
  7. Click the OK button and close the CellValidator collection editor.
  8. Change the document window tab of the designer to Runtime.
  9. Move to the next cell without making any changes in the selected cell and you can confirm that the validation error is displayed.

Using Code

The following code generates a sound as the validation error when the value in textBoxCell is blank.

[VB]

Imports GrapeCity.Win.MultiRow

Dim textBoxCell1 As New TextBoxCell()
Dim requiredFieldValidator1 As New RequiredFieldValidator()
requiredFieldValidator1.Actions.Add(New SoundNotify())
textBoxCell1.Validators.Add(requiredFieldValidator1)

Dim cells As Cell() = {textBoxCell1}
GcMultiRow1.Template = Template.CreateGridTemplate(cells)
GcMultiRow1.RowCount = 10

[CS]

using GrapeCity.Win.MultiRow;

TextBoxCell textBoxCell1 = new TextBoxCell();
RequiredFieldValidator requiredFieldValidator1 = new RequiredFieldValidator();
requiredFieldValidator1.Actions.Add(new SoundNotify());
textBoxCell1.Validators.Add(requiredFieldValidator1);

Cell[] cells = { textBoxCell1 };
gcMultiRow1.Template = Template.CreateGridTemplate(cells);
gcMultiRow1.RowCount = 10;

Trouble Shooting

If the sound is not generated, check the following:

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options