Janus CalendarCombo box quirk

Home/Recent Posts, Uncategorized/Janus CalendarCombo box quirk

Janus CalendarCombo box quirk

As I was working on a new system I encountered problems with the calendar combo field. The date would seeming randomly not fill correctly while other times it would fill fine. I checked to see if it was a problem with certain records or problems in my code but there wasn’t, the calendar could fill itself with the data from any record but would sporadically fail.

Working through the issue I eventually identified the problem; if the calendar already had a date selected, say 01/04/2015 (date of original writing), and then you tried filling the data with the same date, so for example you had two records that had the same date, the calendar box would instead appear empty. A very awkward anomaly.

My initial fix was to add an if statement to ensure the value that we were putting into the calendar wasn’t the same as it’s current value, If calCbo.Value <> NewCalValue Then calCbo.Value = NewCalValue. However for some reason if the value of the calendar is empty the .Value will somehow, seemingly magically, pre-populate itself with the value you’ll eventually assign it before runtime reaches the line that actually assigns the value.

I’ve absolutely no idea how this is even possible let alone why but it does. This means my if statement checking if the values are the same evaluates as true, so the .Value doesn’t get assigned anything, so displays nothing despite saying it has a value during a quick check.

The solution for this is to use the .BindableValue instead of the .Value property. For some reason this property is the only one that works as you’d expect, both .Value and .Text have odd quirks that seem illogical. For the .Value property it seems that it must always contain value and if it doesn’t have a value during runtime it will be automatically assigned one, one way or another…
Even if that way seemly breaks the laws of coding/logic/nature/life/allThingsThatAreGood.

I’ve also posted this issue on the offical Janus forums. Just search for “Filling Calendar Combo the same value displays nothing” in the Subject bar on the forums section of the Janus website http://www.janusys.com/

Author Edward Gwernan-Jones 27/4/15

By | 2015-04-27T11:23:39+00:00 April 27th, 2015|Recent Posts, Uncategorized|0 Comments

About the Author:

Leave A Comment