Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General / November 2004



Tip: Looking for answers? Try searching our database.

File List Box Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mike - 30 Nov 2004 23:18 GMT
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?

Thanks
Ken Halter - 30 Nov 2004 23:33 GMT
> 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..

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.