Re: alphabetically arranging combobox entries

From: Stefan Waldmann (stefan.k.waldmann_at_vr-web.de)
Date: 06/24/04


Date: Thu, 24 Jun 2004 11:21:34 +0200

V S Rawat wrote:
> In my code (given below), I am getting the list of files
> with a particular extension, and adding their filename
> (wihtout extension) to a JCombobox.
>
> It is working but the combobox entries are not appearing
> alphabetically sorted.
>
> Is it possible to pick the filenames in sorted order, or to
> make them appear alphabetically in the combobox?
>
> In what order is it getting the list of files from dos (in
> win98SE)? createdOn? lastModified, lastAccessed? or what?
>
> Is there dos/window utility which can arrange files in that
> physical order in a folder? There was some norton utility I
> had accessed ages ago that was able to do this.

Hi,

I wouldn't rely on OS functions. (Who wants to be platform dependent? ;-)
Just do the sorting yourself in your application.

Collect your file names in an Array or List first, and sort them using
Arrays.sort(...) or Collections.sort(...) before you add them to your
combobox.

HTH

Regards,
Stefan



Relevant Pages

  • Re: Common Dialog - Change file extension
    ... VB's dialog (in fact no common dialog) provides this ... In order to change the extension you have to: ... - send a message to the control to extract the current text in the filename ... the 'Save as type' combobox in the Common Dialog Control. ...
    (microsoft.public.vb.general.discussion)
  • Re: Using an Excel sheet for batch delete
    ... but wondered what the routine would make of the situation where the input to both source and destination popups was identical. ... When I used it on filenames with no extension, ... Does the filename contain any dots. ... If SourcePath = "" Then Exit Sub ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Apply LEN result to string?
    ... If the end result is to strip the extension off a filename then you could do ... Public Function RemoveExtension(ByVal FileName As String, ... Using VB to fetch the filename and placing it in cell B1., ...
    (microsoft.public.excel.programming)
  • Re: Cant copy/paste
    ... MS-MVP Windows Shell/User ... I have these five Nvidia entries disabled. ... Filename: C:\WINDOWS\System32\nvshell.dll ... Extension Name: Desktop Explorer Menu ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Having trouble with OLE - Help please 3rd time asking - No respons
    ... Most of these relate primarily to images, but can be applied to any type of file ... need to parse the extension from the full path when the user selects a file, ... The following FAQ shows how to parse a filename from a full path? ... the path by getting the database location then appending the relative part of the path and the filename. ...
    (microsoft.public.access.modulesdaovba)