This is driving me nuts. Ok, I created a property in our User class. I then try to use it in a code-behind class
User class has the following code in this order:
Private _EBookPolicyAccepted As DateTime = DateTime.MinValue
Public Property EBookPolicyAccepted() As DateTime
Set(ByVal Value As DateTime)
_EBookPolicyAccepted = Value
Private Sub InitValues(ByRef dr As SqlDataReader)
If Not IsDBNull(dr("EBookPolicyAccepted")) Then
_EBookPolicyAccepted = DBConvert.CvDate(dr("EBookPolicyAccepted"))
The user class compiles ok.
Now, in the code-behind of the page I'm working on I have code in this order as so:
Dim cUser As New CurrentUser
Dim vUser As New AAY.VC.User(cUser.UserID)
Private ReadOnly Property EbookPolicyAccepted() As DateTime
Private Sub BookRepeater_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles BookRepeater.ItemDataBound
ElseIf (Me.EbookPolicyAccepted = DateTime.MinValue) Then
eBookPolicyMessage.Text = "something here"
I keep getting an error on this line stating a System Null Exception. I know that the default value in the database for that field is NULL but not sure how to handle and pass it so that I can do that last check in that If statement you see. Obviously I'm not doing this correctly so not sure how.