Guest User

Untitled

a guest
Jan 17th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. private void Form1_Load(object sender, EventArgs e)
  2. {
  3. //check load count...
  4. int loadCount = ApplicationSettingsDemo.Properties.Settings.Default.LoadCount;
  5. if (loadCount > 10)
  6. {
  7. MessageBox.Show("Trial version expired!");
  8. this.Close();
  9. }
  10. }
  11.  
  12. private void Form1_FormClosing(object sender, FormClosingEventArgs e)
  13. {
  14. try
  15. {
  16. ApplicationSettingsDemo.Properties.Settings.Default.LoadCount += 1;
  17. ApplicationSettingsDemo.Properties.Settings.Default.Save();
  18. }
  19. catch (Exception ex)
  20. {
  21. MessageBox.Show(ex.Message,
  22. "Failed to save settings",
  23. MessageBoxButtons.OK,
  24. MessageBoxIcon.Error);
  25. }
  26. }
Add Comment
Please, Sign In to add comment