Design of the User Report Errors in ListBox Date Columns ?

Hi all,

I just added a Contextual Menu to check the Dates on the clicked column and it (now) works fine, but I have two problems:

a. ParseDate was unusable: the date to check uses the ISO 8660 format (SQLdate: 2015-09-25) OR I do not inderstand how to use it. I wasted around half an hour on that (stupid) error. *

b. I do not know how to report the error (if any). I had some solutions in mind like:
a Window with a ListBox and all the found errors (show it once the check is done)
a to report [sorry I forgot the name / used in Xojo IDE)
an error at a time and allow the user to correct it…
add an error mechanism in the CellBackgroundPaint Event to display the wrong date in red,
highlight the wrong date Cell and stop the loop (I love this one; may be a bit boring).
add here your prefered one if not listed above.

Nota: How can I automatize the change process since the software cannot decide by itself the real Sunday value ? The problem is simple: if the date is not a Sunday, the user have to change it by itself; I am against doing things in the back of the user (even if the date is a Saturday or a Monday, some may consider what the Sunday can be, but I think the user have to check the date by itself: the error can be in the month or year numbers…).
At last, the problem is the same in the other method to test if the date is not a Sunday: usually, the date can be a Monday or a Saturday (not always): only the list owner knows if the day of the week is fixed to a specific day or not… **

For the record, I added below the used code to check if the date in the selected Column is a Sunday. Also, I will add a second ContextualMenu to check if the Date IS NOT A SUNDAY… I need both.

[code]// gColNbr holds the selected Column Number…
// gColNbr is filled (elsewhere)
Dim LoopIdx As Integer
Dim RowCnt As Integer
Dim TheDate As String
Dim ColDate As New Date

// Get the number of available Rows
RowCnt = LB.ListCount - 1 // ListCount is 1-based

// Scan the Selected (Date) Column
For LoopIdx = 0 To RowCnt
// Add the Indice value
TheDate = LB.Cell(LoopIdx,gColNbr)

'// Set the date
'ColDate.SQLDate = TheDate // UnsupportedFormatException !!! ***
// Last minute change:
// Set the date
Try
ColDate.SQLDate = TheDate

    Catch err As UnsupportedFormatException
      // not a picture
      Continue
    End

// Check if the date is correct
If ColDate.SQLDate = TheDate Then
// Date.DayOfWeek : 1 = Sunday
If ColDate.DayOfWeek = 1 Then
// It’s a Sunday !

Else
  // Error: the passed date is NOT a Sunday
End If

Else
// The found date does not seems to be a correct date… (or it is not a date !
End If

// To avoid 1, Infinite Loop
If UserCancelled Then Exit
Next[/code]

WARNING: a date I set on purpose: 1935-09-31 was not detected as wrong Sunday… I do not had time yet to check why in ly code (Xojo 2015r1).

  • Am I really right ?
    (about the limited usage of ParseDate)

** Most of the comic strip dailies starts on Monday and ends on Saturday, but not all / I know of a character have two stories (only on more than 70 years) where a story ends in the middle of a week.
TV magazines are published in the week (Friday in France ?), some weekly newspapers sre published on Friday (or on Thursday), and so on.
Records company release records following their own day of release in the week and may sometimes have exceptions too.
Those are reasons why I will not enforce a start day (of the week) and will only check against Sunday in the Day of the Week Method.

*** That is (now I know…) why I wanted to use ParseDate… So I have a bug here !