Showing posts with label INotifyPropertyChanged. Show all posts
Showing posts with label INotifyPropertyChanged. Show all posts

Thursday, May 3, 2012

INotifyPropertyChanged – VB.NET Simple Way

Binding, making the UI data get sync/updated with the data is the most time taking coding area.  This aspect got simplified with the Two Way Binding in WPF or any .Net program.

It is easy to implement a INotifyPropertyChanged in VB program by doing these 3 lines of code where 2 lines at at class level and 1 at object level and not to forget “Imports System.ComponentModel”

Code Lines are:

Public Class SampleClass
        Implements INotifyPropertyChanged

Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged

RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(“Propety Name”))

Example follows:

image

Clear image can be found at http://clip2net.com/s/1Sn4b

Edit:  The INotifyPropertyChanged is for a class or structure, in other terms, it is used to notify (raise event) to whom ever listening or using the property that the value is changed and do the needful as accordingly.