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. Visual Basic
  4. How to handle a propertyvaluechanged event ( or any event) correctly?

How to handle a propertyvaluechanged event ( or any event) correctly?

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestionloungelearning
2 Posts 2 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.
  • D Offline
    D Offline
    David M J
    wrote on last edited by
    #1

    Hi, I have the following problem and I am wondering what the general way is to fix this. I have got a form with an edit and a store button and a customized propertygrid for the user to capture some information. The thing I want to have is that when the user changes a property value in the propertygrid the store button changes from disabled to enabled. I don't want the eventhandler main event handler on the form. I currently have the propertyvaluechanged handler on the customized propertygrid. The form I am using is also a derived form from the standard one. I guess the simple solution would be to create the handler on the form and have the enabled switch in this handler, but then you would have to re-create this routine each time so I am looking for something a bit more generic. Keep in mind that I am still learning a lot about vb, so a solution that you think would be pretty obvious, could very well be completely unknown to me..... Thanks in advanced :confused: Think, try, think, think, try, think, think, think, try, ASK, think, try, advance on step and start over...

    T 1 Reply Last reply
    0
    • D David M J

      Hi, I have the following problem and I am wondering what the general way is to fix this. I have got a form with an edit and a store button and a customized propertygrid for the user to capture some information. The thing I want to have is that when the user changes a property value in the propertygrid the store button changes from disabled to enabled. I don't want the eventhandler main event handler on the form. I currently have the propertyvaluechanged handler on the customized propertygrid. The form I am using is also a derived form from the standard one. I guess the simple solution would be to create the handler on the form and have the enabled switch in this handler, but then you would have to re-create this routine each time so I am looking for something a bit more generic. Keep in mind that I am still learning a lot about vb, so a solution that you think would be pretty obvious, could very well be completely unknown to me..... Thanks in advanced :confused: Think, try, think, think, try, think, think, think, try, ASK, think, try, advance on step and start over...

      T Offline
      T Offline
      Tom John
      wrote on last edited by
      #2

      In your inherited control override the protected sub OnPropertyValueChanged: Protected Overrides Sub OnPropertyValueChanged(ByVal e As System.Windows.Forms.PropertyValueChangedEventArgs) 'Put your code here to fire when the property is changed 'Make sure you call the base method you are overriding MyBase.OnPropertyValueChanged(e) End Sub In the base class (Windows.Forms.PropertyGrid) this method will simply fire the PropertyValueChanged event, by overriding the sub you can 'slip' your own code in before the event is fired. More info on this method is available on MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformspropertygridclassonpropertyvaluechangedtopic.asp[^] It is worth investigating these protected methods when you inherit from other classes. Hope this helps Tom

      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