Please bear with me, but here I go again
I have a 3 column list box which pretty much replicates the same information you would get in an “open file” system dialog box.
I don’t want to use the “open dialog” because this is just a simple “fly-out” box that shows the user, as a “reminder” to what has been done before and also gives them the opportunity to apply the same filename in a test series without having to remember it:
If you look at the middle column (> Test Number, Date etc…) this “almost” does what I want because the file name includes a “Test Number” + an incremental numeric number, then date, time etc.
For the most part this works fine because listboxes sort alphabetically, as can be seen with the “Test Number” column. There is no doubt about the chronological order - and this works regardless of the system date/time settings.
BUT
The test number is only applied to files that are recorded within the system. Imported files are not given a test number or date (as per the last 3 items in the list) as the details are input by the user. Therefore the sorting can become confusing. They can sort via Test “Name” but that’s still not good enough - they need to know what was done recently.
This was tested by my “Alpha” tester, and he became confused of how to find the most recent test.
So, now I have a third column “Chronological” and of course we can see that it doesn’t sort correctly because a listbox will only sort alphabetically. I’m happy enough to just have a number in there, ie. using TotalSeconds, but I couldn’t even get that working.
For what it’s worth, here’s the code:
[code] Dim myFolder As FolderItem = SpecialFolder.ApplicationData.Child(myAppDataFilesFolder)
Dim delimiter As String = &u22b3
Dim delimiterPos as Integer
Dim testName, testNumber As String
listSavedFiles.DeleteAllRows // first clear the previous list
//---
Dim filecount As Integer = myFolder.Count
For i As Integer = 1 To filecount
Dim f As FolderItem = myFolder.Item(i)
If f <> Nil AND f.Name.Right(6) = ".final" Then //Only show *.final files in the listbox
//-------------------------------------------------------POPULATE THE LISTBOX-------------
delimiterPos = InStr(f.Name, delimiter)
testName = Left(f.Name, delimiterPos-2) //extract test Name from filename
testNumber = Right(f.Name, Len(f.Name)-delimiterPos+1) //extract test Number from filename
listSavedFiles.AddRow(testName)
listSavedFiles.Cell(ListSavedFiles.LastIndex,1) = testNumber
Dim sysDateMod As String = (f.ModificationDate.ShortDate)
'Dim d As New Date
'Dim sysDateMod As Double = (d.TotalSeconds)/60
'sysDateMod = Format(sysDateMod,"0000000000")
listSavedFiles.Cell(ListSavedFiles.LastIndex,2) = sysDateMod
//----------------------------------------------------------------------------------------
End If
Next[/code]
You can see near the end where I experimented with “TotalSeconds” with the variable sysDateMod, in the remarked out code. I had too many errors.
I’m hoping there is a more elegant solution and appreciate your thoughts.