|
-
Nov 13th, 2005, 07:18 PM
#1
Thread Starter
Addicted Member
[RESOLVED] SaveFileDialog Question
I have 2 filters on my dialog: *.m3u and *.wpl. How do I find out what choice the user made?
A programmer is a person who fixes a problem you did not know you had in a way that you cannot understand.
-
Nov 13th, 2005, 07:29 PM
#2
Re: SaveFileDialog Question
You need to check the .FilterIndex property to see which the user choose but they could still have typed in the file with a different acceptable extension.
VB Code:
SaveFileDialog1.FilterIndex
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 
-
Nov 13th, 2005, 07:36 PM
#3
Re: SaveFileDialog Question
Or just get the right 3 characters returned from the filepath of the dialog...
VB Code:
Dim MyExtension as String
MyExtension = strings.right(ReturnDialogString, 3) 'returns last 3 letters, replace returndialogstring with filepath returned from dialog
Select Case MyExtension
Case Is = "m3u"
MsgBox("m3u")
Case Is = "wpl"
MsgBox("wpl")
Case Else
MsgBox("Not A Supported FileType!")
Exit Sub
End Select
EDIT*** - uppercase extensions won't work with this code, you have to do myextension = myextension.tolower in order to always make it lowercase in order for it to work, or change your case statements to also evaluate it for the uppercase M3U or WPL
Last edited by gigemboy; Nov 13th, 2005 at 07:45 PM.
-
Nov 13th, 2005, 07:46 PM
#4
Re: SaveFileDialog Question
Use IO.Path to manipulate file paths, e.g. IO.Path.GetExtension(mySaveFileDialog.FileName)
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
|