Null dates in listview


Author
Message
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
William John Tello (09/09/2008)
Out of curiosity, why would you assign the displayvalue property to String.Empty as opposed to ""

Hi William,

It is just for readability of the code, I rather see String.Empty than '' or "", in VFP you could use '', "", [] Tongue

Edhy Rijo

William John Tello
William John Tello
StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)
Group: Forum Members
Posts: 17, Visits: 80
Edyhy,

Out of curiosity, why would you assign the displayvalue property to String.Empty as opposed to "" (which is what I would have done and I think a more C# standard way to do it).  I'm just curious if there is an advantage to using the Empty static method of the .Net string class?

I'm also assuming there the C# string type must also have a string.Empty() counterpart (which I might have favored because I tend to use the C# types over the .Net types in my own coding).

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Lesscher,

You can use the ListView.RowPopulating event to handle that situation and many more...

Private Sub lstItems_RowPopulating(ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.RowPopulatingEventArgs) Handles lstItems.RowPopulating

     '-- Cast the BO to the type needed.

     Using bo As bizItems = DirectCast(e.BusinessObject, bizItems)

          If bo.MyDateTimeField = Nothing orElse bo.MyDateTimeField = #1800-1-1# then

               e.Values(ColumnIndex).DisplayValue = String.Empty

          End If

          End Using

End Sub

I have not tested the above, but that can give you an idea.

Edhy Rijo

Lesscher
Lesscher
StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)
Group: StrataFrame Users
Posts: 9, Visits: 19
Hi,



More questions about null values... Smile



I use a datepicker to display a date. I have to use the replacement value trick (1800-1-1) in order to save a NULL value when there is no date. No problems here...



How can I show this field in a listview without showing the value 1800-1-1 to the user?



Regards,



Lesscher
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search