?
Solved

Updating a drivecombobox

Posted on 1998-07-22
5
Medium Priority
?
542 Views
Last Modified: 2010-04-03
I'm using a drivecombobox on a form and would like to be able to update it by pressing a button.

When I say update, I mean that I mapped to a network drive while the program is already running, and would like my application to detect this new drive without me having to close and reopen the application.

If there is a way to detect the change and update without even having to associate it to a button... even better.

Thanks in advance
0
Comment
Question by:rafy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1358473
Try this:
Maybe in OnTimer()....or you think of something...

DriveComboBox1.Update;//Updates and if there are new drives it will detect it hopefully...

Viktor Ivanov
0
 

Author Comment

by:rafy
ID: 1358474
Nope update doesn't do it... it only repaints the object...
0
 

Expert Comment

by:westy100697
ID: 1358475
Hey Rafy try  DlgDirListComboBox() in Win32 and see if that helps. You will have to look at the command yourself but it has the ability to add all the current Drives, Directories etc.

You may have to call  CB_RESETCONTENT to clear the drive box first and reset it and then use the first procedure I mentioned. See if it helps...

WESTY :)
0
 

Author Comment

by:rafy
ID: 1358476
No... too messy...

I already found a much better solution... delete and recreate the object....Works for me.

Consider this question deleted (I'd delete it but I don't see that option).
0
 
LVL 4

Accepted Solution

by:
itamar earned 100 total points
ID: 1358477
Hi rafy,

this is the source code for a component that brings a reload method you can call from a Timer event:

>>>>>

type
  TNewDriveComboBox = class(TDriveComboBox)
  private
  protected
  public
     procedure Reload; virtual;
  published
  end;

procedure Register;

implementation

procedure TNewDriveComboBox.ReLoad;
begin
  inherited BuildList;
end;

procedure Register;
begin
  RegisterComponents('Samples', [TNewDriveComboBox]);
end;
<<<<<<

IHTH,
Itamar
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

801 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