Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Catching the Exception thrown from a property that change throu DataBinding [modified]

Catching the Exception thrown from a property that change throu DataBinding [modified]

Scheduled Pinned Locked Moved C#
questionwpfwcf
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NassosReyzidis
    wrote on last edited by
    #1

    Hello All, i have a property in my DataClass and i bound it to a control Binding adminBind = new Binding("Checked", user, "IsAdministrator"); this.chkIsAdmin.DataBindings.Add(adminBind); this Property throw an Exception when some conditions not meet (this code is inside the set of the Property). public bool IsAdministrator { get { return Convert.ToBoolean(_Record.WL_ISADMIN.Value); } set { //If the New value is true if (value) { if (CanBeTheUserAdmin())//Check if the Garage Has Admin User { //No Admin User, This Becomes Admin _Record.WL_ISADMIN.Value = value; } else//If the Garage Has Admin User throw Exception throw new Exception("Δεν Μπορείτε να κάνετε τον Χρήστη Administrator διότι Υπαρχει ήδη Administrator για το Συνεργείο!!"); }else//If the New value is False, applying it to the user _Record.WL_ISADMIN.Value = value; } } right now when the exception is thrown the control just DON'T lose Focus, and the user get confused. How can i cath the Exception in order to show the Exception Message to the User?? Any Saggestion is most Wellcome! Nassos -- modified at 7:41 Thursday 16th November, 2006

    GanDad

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups