Results 1 to 8 of 8

Thread: [RESOLVED] capturing file format in file list box

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    97

    Resolved [RESOLVED] capturing file format in file list box

    hey all..

    how can i capture the format (example: .exe, .txt) of a file being displayed in a file list box??

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

    Re: capturing file format in file list box

    Use the properties - File1.Path and/or File1.FileName
    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

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    97

    Re: capturing file format in file list box

    So how will it go??

    For example:

    If file1.filename = *.wav then
    mmcontrol1.devicetype = "Wave Audio"
    end if

    like that??

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

    Re: capturing file format in file list box

    This will tell you what is selected.
    VB Code:
    1. Private Sub File1_Click()
    2.     MsgBox File1.List(File1.ListIndex)
    3. End Sub
    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

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

    Re: capturing file format in file list box

    This will parse the file extension and add an asterisk in front of it.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub File1_Click()
    4.     MsgBox "*" & Mid$(File1.List(File1.ListIndex), InStrRev(File1.List(File1.ListIndex), "."))
    5. End Sub
    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

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    97

    Re: capturing file format in file list box

    thanx for the effort...but let me clarify ...

    Im designing a media player...something that plays music (for now)...and im using a multi media control...so i need to specify a "device type" based on the file extension for the file im trying to play...

    and since i dont know whats the file extension...i have to capture it from the file list box...

    thus: for example:

    if (statement to capture the extension) = .wav then
    mmcontrol1.devicetype = "Wave Audio"
    end if

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Dec 2005
    Posts
    97

    Re: capturing file format in file list box

    sorry didnt see ur last post...i think that will work...thanxx

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