> Hi,
>
> I want to limit the user from picking more than 36 files in my file list
> box. The only solution i could come up with is loop through the list and
> have a counter increment if the list item is selected. Is there a better
> solution?
Here's a way to get the number of selected items without the loop. hth
'=============
Option Explicit
Private Declare Function SendMessageLong _
Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Sub Command1_Click()
MsgBox "Number of items selected = " & SelCount
End Sub
Private Function SelCount() As Integer
Const LB_GETSELCOUNT = &H190
SelCount = SendMessageLong(File1.hWnd _
, LB_GETSELCOUNT, 0&, 0&)
End Function
'=============

Signature
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..