Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Property is null just the first time
1 replies. Latest Post by DJanjicek on July 21, 2009.
(0)
Agnushal...
Member
54 points
140 Posts
07-21-2009 1:57 PM |
How I test if the property is empty or null If the first time I used the property it is always empty or null
Public Sub New() InitializeComponent() objnumero.NOME = "" gridvalida.DataContext = objnumero End Sub
Private privateNOME As String Public Property NOME() As String Get Return privateNOME End Get Set(ByVal value As String) If String.IsNullOrEmpty(value) Then Throw New Exception("Obrigatório") End If privateNOME = value NotifyPropertyChanged("NOME") End Set End Property
DJanjicek
Participant
970 points
324 Posts
07-21-2009 2:31 PM |
If (Not String.IsNullOrEmpty(objnumero)) gridvalida.DataContext = objnumeroEnd IfSomething like that?