Results 1 to 7 of 7

Thread: can somebody tell me why (RESOLVED)

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    Resolved can somebody tell me why (RESOLVED)

    can somebody try and explain why I can only add a maximum of 7 files at a time using this code

    thanks

    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3.     Dim i As Integer
    4.  
    5.     ProgressBar1.min = 0
    6.     'ProgressBar1.Max = 100
    7.     ProgressBar1.Value = 0
    8.     ProgressBar1.Scrolling = ccScrollingSmooth
    9.  
    10.     Dim strFile() As String, strPath As String
    11.     Dim n As Long, nCount As Long
    12.     On Error Resume Next
    13.     With CommonDialog1
    14.         .Flags = cdlOFNAllowMultiselect + cdlOFNExplorer
    15.         .CancelError = True
    16.         .InitDir = "C:\"
    17.         .DialogTitle = "Select File To Add To Playlist"
    18.      
    19.         .ShowOpen
    20.         If Err.Number <> cdlCancel Then
    21.             strFile = Split(.FileName, vbNullChar)
    22.             nCount = UBound(strFile)
    23.             If nCount = 0 Then
    24.                 'Only one file is selected so split up the path and the filename
    25.                 ReDim strFile(1)
    26.                 strFile(0) = Left$(.FileName, InStrRev(.FileName, "\"))
    27.                 strFile(1) = Mid$(.FileName, InStrRev(.FileName, "\") + 1)
    28.                 nCount = 1
    29.             End If
    30.             strPath = strFile(0)
    31.             If Right$(strPath, 1) <> "\" Then
    32.                 strPath = strPath & "\"
    33.             End If
    34.             ProgressBar1.Max = nCount
    35.             For n = 1 To nCount
    36.                 If Len(Dir(FAVORITES_FOLDER & strFile(n))) = 0 Then
    37.                     FileCopy strPath & strFile(n), FAVORITES_FOLDER & strFile(n)
    38.                 End If
    39.                 ProgressBar1.Value = nCount
    40.             Next
    41.         End If
    42.     End With
    43. End Sub
    Last edited by robvr6; Feb 8th, 2005 at 12:34 AM. Reason: resolved

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: can somebody tell me why

    Try...
    VB Code:
    1. .Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNLongNames
    Also, what is the length or your 7 file names that are selected? Try varing the files selected too. Just a hunch.

    Edit: I forgot to tell you "Why"
    Last edited by RobDog888; Feb 8th, 2005 at 12:09 AM.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    Re: can somebody tell me why

    Thanks for reply,they are all quite short because they are mp3 files

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: can somebody tell me why

    is it a limit of winamp? can you add more by hand?

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: can somebody tell me why

    The commond dialog object only returns a maximum of 260 characters in the FileName property. Maybe you should build your own dialog using the File listbox instead?

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2005
    Posts
    277

    Re: can somebody tell me why

    what RobDog888 suggested worked because I just manged to add 20 which is quite ample.

    Thanks very much for the replies
    R

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: can somebody tell me why (RESOLVED)

    Was it the + 'ing of the flags or the cdlOFNLongNames flag? I read somewhere
    that you needed the longfilenames flag with that combination.

    Either way, glad my suggestion worked.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width