3

I have a default data entry screen in Lightswitch. Problem is, when the user does not wish to enter a new record, the user closes the screen to navigate elsewhere. Upon closing the form, the user is presented with the "Save changes before closing?" message. Is there a way I can suppress this message in a scenario in which the user has not entered any data in this screen?

Shawn de Wet
  • 5,642
  • 6
  • 57
  • 88

1 Answers1

3

In the screen's Closing method, you can add a call to DiscardChanges for the entity that the screen is bound to (which I've called EntityPropertyName in the code below).

VB:

Me.EntityPropertyName.Details.DiscardChanges

C#:

this.EntityPropertyName.Details.DiscardChanges();
Yann Duran
  • 3,842
  • 1
  • 24
  • 24