Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6573603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:09:16+00:00 2026-05-25T15:09:16+00:00

unit unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,FileCtrl,omnixml,omnixmlutils;

  • 0
unit unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,FileCtrl,omnixml,omnixmlutils;

type
  TForm1 = class(TForm)
    btn1: TButton;
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    procedure olddiris(name:string);
    procedure GetPath(name:string);
    { Public declarations }
  end;

var
  Form1: TForm1;
  olddir: string; //global variable.

implementation

{$R *.dfm}

procedure Tform1.olddiris(name:string);
  begin
    if name = 'trick' then
     olddir:= 'c:\program files'+name;
  end;
procedure Tform1.GetPath(name:string);
  var
    options : TSelectDirOpts;
  begin
    OldDirIs(name);  //returns olddir
    if SelectDirectory(OldDir,options,0) then
      ShowMessage('i got it');
  end;

procedure TForm1.btn1Click(Sender: TObject);
begin
   getpath('trick');
end;

end.

Options is TSelectDirOpts = set of TSelectDirOpt;

TSelectDirOpt Standard is {TSelectDirOpt = (
sdAllowCreate,
sdPerformCreate,
sdPrompt
)

gFindDirs is a simple variable that keeps the Name nothing else so i erase it.
The setPath(gFindDirs) just forget it ok i replace it with a simple massage..

When I run it i get an error: the “class Estringlist.error: List index out of bounds(0)”;
I try this with the component jvselectdirectory of jvcl library but I get the same thing…
in jvselectdirectory if I left it empty it goes me to the default application folder…

Here is all the program… push the button get the name turn into an existing directory i create before and try to open it with the selectdirectory that’s it i get the above error…
FULL CODE nothing else create a form and put a button one event onclick().

Oops Sorry i fix it…. The rush to fix it wrong copy paste…
Help…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:09:17+00:00Added an answer on May 25, 2026 at 3:09 pm
    var
    olddir: string; //global variable
    
    procedure olddiris(name:string);
    begin
        if name = 'trick' then
         olddir:= 'c:\program files\'+name;
      end;
    
    procedure MyGetPath(name:string);
      var
        options : TSelectDirOpts;
      begin
        OldDirIs(name);  //returns olddir
        if FileCtrl.SelectDirectory(OldDir,options,0) then
          ShowMessage('i got it');
      end;
    
    procedure TForm1.Button1Click(Sender: TObject);
      begin
       Mygetpath('trick');
      end;
    

    This code runs without error… (Note: changed GetPath -> MyGetPath; added “\” to ‘c:\program files’) If the problem still exists, look elsewhere in you code or post more code/info.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

unit Unit2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,
I'm using Delphi 2006 and psvActiveScript . Example: unit Unit1; interface uses Windows, Messages,
Hi I have a problem with this code: unit Unit1; interface uses Windows, Messages,
Why will this not compile in Delphi 2009? unit VistaFolders; interface uses Windows, ShellAPI,
unit Unit7; interface uses Classes; type TListener = class(TThread) procedure Execute; override; end; TMyClass
I have put together this code for creating a dynamic form unit Unit1; interface
I want to unit test a RESTful interface written with Apache CXF. I use
What is the difference between: type IFooable = interface IDisposable abstract Foo : (unit
Unit testing Abstract classes in Groovy I asked a question previous about unit testing
I need to execute my code after finalization of SysUtils unit. I've placed my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.