February 22, 2020, 01:39:22 pm
News: IF YOU ARE A MEMBER FROM THE ORIGINAL SITE AND CAN'T LOGIN. POST IN THE FEEDBACK FORUM (AS GUEST) AND AN ADMIN WILL ASSIST YOU TO ACCESS THE SITE!
Pages: [1]   Go Down
Author Topic: VB - File list box  (Read 4283 times)
simmo
Administrator
*

Stars: +3/-0
Offline Offline

Gender: Male
Posts: 8545



« on: December 02, 2002, 10:59:17 pm »

Basicly I want to have a list box that has the file names that are in a directory listed there... I can do it in ASP but this isn\'t ASP.
Thanks
Michael
Logged

                 ..... .....

Joe
Supporters
*

Stars: +0/-0
Offline Offline

Posts: 6104



WWW
« Reply #1 on: December 02, 2002, 11:15:15 pm »

The easiest and most obvious suggestion would be to use a FileListbox, but here\'s the fastest way to do it with a regular Listbox
[vbcode]
Private Declare Function SendMessageStr Lib \"user32\" Alias \"SendMessageA\" (ByVal hwnd As Long, _
                                                                           ByVal wMsg As Long, _
                                                                           ByVal wParam As Long, _
                                                                           ByVal lParam As String) _
                                                                           As Long

Private Const LB_DIR = &H18D
Private Const DDL_READWRITE = &H0

Private Sub Command1_Click()
    Call SendMessageStr(List1.hwnd, LB_DIR, DDL_READWRITE, \"c:*.*\")
End Sub
[/vbcode]

There are other DDL_ constants that affect what files are shown as well.

Logged

Let the probing begin! smile

simmo
Administrator
*

Stars: +3/-0
Offline Offline

Gender: Male
Posts: 8545



« Reply #2 on: December 02, 2002, 11:19:43 pm »

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Originally posted by Joe
The easiest and most obvious suggestion would be to use a FileListbox...[/quote]
Hmm... what is a file list box... that may be what I want (I\'m an ASP programmer that only dabled in VB before)
Logged

                 ..... .....

Joe
Supporters
*

Stars: +0/-0
Offline Offline

Posts: 6104



WWW
« Reply #3 on: December 02, 2002, 11:21:11 pm »

Its one of the standard controls in the toolbox.  The icon looks like a piece of paper with one of the corners folded.
Logged

Let the probing begin! smile

simmo
Administrator
*

Stars: +3/-0
Offline Offline

Gender: Male
Posts: 8545



« Reply #4 on: December 02, 2002, 11:24:26 pm »

cool. found it.
(how do i tell it what directory?)
Logged

                 ..... .....

simmo
Administrator
*

Stars: +3/-0
Offline Offline

Gender: Male
Posts: 8545



« Reply #5 on: December 02, 2002, 11:25:06 pm »

and when the directory changes will it aout update?
Logged

                 ..... .....

Joe
Supporters
*

Stars: +0/-0
Offline Offline

Posts: 6104



WWW
« Reply #6 on: December 02, 2002, 11:26:08 pm »

Change the Path property.

Logged

Let the probing begin! smile

simmo
Administrator
*

Stars: +3/-0
Offline Offline

Gender: Male
Posts: 8545



« Reply #7 on: December 02, 2002, 11:36:58 pm »

thanks awesome
(i gave a tick)
Logged

                 ..... .....

simmo
Administrator
*

Stars: +3/-0
Offline Offline

Gender: Male
Posts: 8545



« Reply #8 on: December 03, 2002, 10:48:26 pm »

Question... I have a timer on this app cos it basicly sits there and does stuff every 30 secs or so... but I can\'t figure out how to get it to update the file lists... I set the directory on load and have tried resetting them, or setting them to \"\" and them to back but to no avail.
Logged

                 ..... .....

rjlohan
Founders
*

Stars: +0/-0
Offline Offline

Posts: 2355



WWW
« Reply #9 on: December 03, 2002, 10:57:11 pm »

Have you tried:

[vbcode]
File1.Refresh
[/vbcode]
Logged

---------------------------------------
-RJ Lohan
Ryan.J.Lohan@student.uts.edu.au
---------------------------------------
"Second?!? That's just a fancy word for 'loser'!!"
---------------------------------------

simmo
Administrator
*

Stars: +3/-0
Offline Offline

Gender: Male
Posts: 8545



« Reply #10 on: December 03, 2002, 11:31:39 pm »

And there is a tick for you  I never would have thought of that.
Logged

                 ..... .....

rjlohan
Founders
*

Stars: +0/-0
Offline Offline

Posts: 2355



WWW
« Reply #11 on: December 03, 2002, 11:34:43 pm »

Better make sure it works first...
Logged

---------------------------------------
-RJ Lohan
Ryan.J.Lohan@student.uts.edu.au
---------------------------------------
"Second?!? That's just a fancy word for 'loser'!!"
---------------------------------------

simmo
Administrator
*

Stars: +3/-0
Offline Offline

Gender: Male
Posts: 8545



« Reply #12 on: December 04, 2002, 05:02:42 pm »

I did (no premature ticking here  ) (That was one of the things I asked about when you first came up w/the hack though)
Logged

                 ..... .....

Pages: [1]   Go Up
Print
 
Jump to: