|
-
Oct 24th, 2007, 04:01 AM
#1
Thread Starter
Frenzied Member
[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))
-
Oct 24th, 2007, 04:08 AM
#2
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 Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API 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 
-
Oct 24th, 2007, 04:12 AM
#3
Frenzied Member
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!
-
Oct 24th, 2007, 10:13 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|