Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FileListBox

1 view
Skip to first unread message

LondonLad

unread,
Dec 24, 2009, 9:00:03 AM12/24/09
to
Hi
I have 2 FileListBox's on a form File1 and File2 when the program runs each
box is loaded with different file extension's if I want to move say Item 2 in
File1 then because Item 2 in File2 is related that also has to be moved.
My question is when I click to highlight Item 2 in File1 can this trigger
code to automatically highlight Item 2 in File2?

MikeD

unread,
Dec 24, 2009, 10:30:50 AM12/24/09
to

"LondonLad" <Lond...@discussions.microsoft.com> wrote in message
news:7E7876DF-06F8-4313...@microsoft.com...

Just write the code in File1's Click event.

Or is there more to this that you're not telling us?

--
Mike

Ralph

unread,
Dec 24, 2009, 11:21:21 AM12/24/09
to

"LondonLad" <Lond...@discussions.microsoft.com> wrote in message
news:7E7876DF-06F8-4313...@microsoft.com...

Yes.

You can synchronize selection (highlighting) between two ListBox controls by
merely adding code to manage one ListBox to the click event in the other.

It is not possible to provide a more concrete example as "is related" is not
defined. One can guess, but that is seldom useful. <g>

Try explaining your particular problem in more detail. Also might I suggest
you be a tad more "Hungarian" in your description. eg, is "File1" a
"ListBox1"? Or ????

-ralph


Ralph

unread,
Dec 24, 2009, 11:29:16 AM12/24/09
to

"MikeD" <nob...@nowhere.edu> wrote in message
news:%23wJJV4K...@TK2MSFTNGP06.phx.gbl...

I thought it was your day to have the Crystal Ball?

Duties and responsibilities always seem to get mucked up over the Holidays.

[OT: I was watching a game the other day and they showed the fans out there
shovelling snow off the pitch. I got a chuckle from it. Is that normal over
there?]

-ralph


LondonLad

unread,
Dec 24, 2009, 12:44:01 PM12/24/09
to
Hi to MikeD & Ralph
Yes File1 and File2 are FileListBox's I would guess from MikeD's reply what
I want to do is possible.
Not sure what code I need for the click event can you point me in the right
direction please, or a snippet of code?
I need to be able to keep them in pairs


"MikeD" wrote:

> .
>

Rick Rothstein

unread,
Dec 24, 2009, 12:59:00 PM12/24/09
to
I'm not sure how you know the two (what I assume are different) directories
are "in synch" with each other, but assuming that is the case, then this
line of code will select the same item number (list index) in File2 that you
clicked in File1...

File2.ListIndex = File1.ListIndex

HOWEVER, executing this code will trigger a click even in File2, so if you
have code in the File2 Click event, you might have to create a global flag,
set it in File1's Click event, check it in File2's click event where, if
set, unset it and then exit the sub.

--
Rick (MVP - Excel)


"LondonLad" <Lond...@discussions.microsoft.com> wrote in message

news:E9A5B2AB-9F9E-45C7...@microsoft.com...

LondonLad

unread,
Dec 25, 2009, 6:05:02 AM12/25/09
to
Hi Rick
Thanks for the post. I need to clear some errors from my earlier post eg
Synch this is not true what I have is a photo with 2 diff formats 1 *.JPG and
the other *.NEF(Raw) bothe are from the same directory each FileListBox File1
and File2 is loaded with the pattern set to JPG or NEF the problem I have is
to Index File2 File1 is already Indexed I think if I can do that your code
will work OK. At the moment I get an error.
Can you help further please?

Also I have set the File2.Enabled to False will this stop the click event?

Regards

"Rick Rothstein" wrote:

> .
>

Larry Serflaten

unread,
Dec 25, 2009, 8:11:24 AM12/25/09
to

"LondonLad" <Lond...@discussions.microsoft.com> wrote

> Hi Rick
> Thanks for the post. I need to clear some errors from my earlier post eg
> Synch this is not true what I have is a photo with 2 diff formats 1 *.JPG and
> the other *.NEF(Raw) bothe are from the same directory each FileListBox File1
> and File2 is loaded with the pattern set to JPG or NEF the problem I have is
> to Index File2 File1 is already Indexed I think if I can do that your code
> will work OK. At the moment I get an error.

Here's a question. If the user cannot interact with one of the lists, then
why show it at all?

LFS


LondonLad

unread,
Dec 25, 2009, 11:26:01 AM12/25/09
to
Hi Larry
The user does not have to interact with the one of the lists but the list
needs to be linked to the selection.
When the user selects a Nef Photo in list 1 this is linked to a selected
folder for storage in a sub folder by location name, what I want to happen is
in a different folder location create a sub folder of the same location name
and store the Jpg there. This way all photo's are stored by location but with
the Jpg's on my computer and the Nef's on a separate hard drive. Later if I
want to restore a particular photo the location and shot number will make it
easy to find.
The problem is that numbers do get duplicated so this was my idea to help
solve the situation when recollection can be a bit vague.
I hope this explains what I want to do.

Regards

"Larry Serflaten" wrote:

> .
>

0 new messages