Retrieve date with file for listbox and sort

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akirekab
    New Member
    • Oct 2006
    • 47

    Retrieve date with file for listbox and sort

    I am using the following to retrieve a file and put in listbox. It is working fine.
    I would like to build on it to include the datecreated of the file and be able to also sort with that date.

    [CODE=vb]
    Const iPath = "C:\patient\sca ns\Insurance\"
    Dim myInsFile As String
    Dim strPatientId As String

    myInsFile = Dir(iPath & strPatientID & "*.*")

    lstInsurance.Cl ear

    Do While Not myInsFile = vbNullString

    lstInsurance.Ad dItem myInsFile
    myInsFile = Dir

    Loop
    [/CODE]

    Thank you for any help
    Ken
    Last edited by debasisdas; Feb 28 '08, 07:40 AM. Reason: added code=vb tags
  • VijaySofist
    New Member
    • Jun 2007
    • 107

    #2
    Hi!

    I think you are trying to add the files to the ListBox by getting a FolderName(with path). If this is your criteria means you can use a FileListBox Control instead of a ListBox Control. It will display all the files from your folder path. You can also sort it in Ascending or Descending order.


    With Regards
    Vijay. R

    Comment

    • akirekab
      New Member
      • Oct 2006
      • 47

      #3
      I am not sure how the filelistbox works.
      But my objective is to retrieve a set of files with criteria of a number, and only that set of files. It may be one or a dozen files starting with nxxxxx, I would like the file name and date in the list box or file list box if thats possible and in descending order.Then the customer can double click and display the file.

      I do not want all the files currently active showing.

      I put a file list box in but it showed all current files of the program. Maybe you could give me an example of using the same type of code I have in here, but utilizing a file list box.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        You might want to try out the ListView control. It allows you to create entries with a number of attributes, which can be viewed as a list, icons and so on, much like Windows Explorer.

        Another alternative would be to use a simple grid control, with columns for the pieces of information you're interested in such as name and date.

        Comment

        • akirekab
          New Member
          • Oct 2006
          • 47

          #5
          Thnks Killer

          First I would like to apologize, I had to leave state, and didnt get back to this till now.

          One question on your comment, is the control you reference going to work in VB5 ?

          Ken

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by akirekab
            One question on your comment, is the control you reference going to work in VB5 ?
            Um... to be honest, I have no idea.

            If VB5 doesn't include the Listview control then you may have to track down a copy somewhere. Whether it will actually work, I don't know. But these controls are more or less useable with any language that can use ActiveX controls, aren't they? If someone else here knows more about this sort of compatibility, please let us know.

            Comment

            Working...