Solved

Open folder

Posted on 2003-11-19
6
948 Views
Last Modified: 2008-02-01
Hi.. I'm using Delphi 6 in Windows XP, and I want the user to choose the folder name in which he will use the data in that folder as the database. I want to get the folder name which the user has chosen.. Is it using Open Dialog Box or using something else? Any help will be very much appreciated :) Thanksss..
0
Comment
Question by:pipinana2002
  • 2
  • 2
  • 2
6 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 9785043
there is a selectdirectory-function

a sample

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses filectrl; //filectrl is used

procedure TForm1.Button1Click(Sender: TObject);
var s : string;
begin
  s := '';
  if selectdirectory(s,[],0) then
    showmessage('Directory '+s+' is selected');
end;

end.

meikl ;-)
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 9785061
pipinana2002,
  You could use:
1) TDirectoryListBox from Win3.1
2) TDirectoryEdit from RX components (http://sourceforge.net/projects/rxlib/)
  for selecting folder names.
HTH,
...Snehanshu
0
 

Author Comment

by:pipinana2002
ID: 9785070
Hi meikl..

Thanks for your help :)

Can I actually remove the files and drives list from the display?

Thanks againn.. :)
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 5

Expert Comment

by:snehanshu
ID: 9785072
Thanks meikl,
  I did not know about that!
  pipinana2002: you have the solution from the best.
:-)
...Snehanshu
0
 

Author Comment

by:pipinana2002
ID: 9785091
Hi again meikl.. I already found how to do it.. hehehehehe thanks a lot for your helpp :):):) U're really great! :)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9785271
glad you got it,

to use another dialog-style,
just use the other syntax

procedure TForm1.Button1Click(Sender: TObject);
var s : string;
begin
  s := '';
  if selectdirectory('Select A Directory','',s) then
    showmessage('Directory '+s+' is selected');
end;

meikl ;-)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question