Results 1 to 4 of 4

Thread: [RESOLVED] don't want extension common dialog

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] don't want extension common dialog

    I use common dialog. I set filter to this extension *.shp. I don't want include the extension to display the filename. I just want file1 only not file1.shp


    Code:
    CommonDialog1.Filter = "ESRI Shapefiles (*.shp)|*.shp"
    CommonDialog1.CancelError = True
    CommonDialog1.InitDir = App.path
    CommonDialog1.DefaultExt = ".shp"
    CommonDialog1.ShowOpen
    CommonDialog1.DialogTitle = "Add data"
    sfname = CommonDialog1.FileTitle
    path = Left(CommonDialog1.FileName, _
                Len(CommonDialog1.FileName) - _
                Len(CommonDialog1.FileTitle))

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

    Re: don't want extension common dialog

    Just use the fileTitle property and mid$ function to chop off the extension.

    Code:
    path  = Mid$(CommonDialog1.FileTitle, 1, InStr(1, CommonDialog1.FileTitle, ".") - 1)
    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
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: don't want extension common dialog

    don't want include the extension to display the filename
    in the File Name textbox of dialog? It is not by default displayed!

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: [RESOLVED] don't want extension common dialog

    That depends on the setting in Windows Explorer (Tools/Folder Options/View/Hide extensions for known file types), not in anything in CommonDialog settings.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

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