I have checked all the prior forum questions on this topic, but none of the options seem to be working for me.
I am creating an output file that goes into a specific folder for getting MP3 file information.
When I run inside of Visual Studio Community 15, it works great ... no errors. When I take the EXE and create a new folder for the actual application and run by itself is when I get the error. I have tried turning on the UAC to Admin rights, with no luck.
Here is my code
Private Sub cmdCreateFile_Click(sender As Object, e As EventArgs) Handles cmdCreateFile.Click Dim InFolder As String = txtFolderToBrowse.Text Dim sInFile As String Dim sTitle As String Dim sArtist As String Dim MyData As MediaID3Structure Dim sOutput As String Dim sCurrentPath As String Dim filePath As String Dim fileName As String Dim swFile As StreamWriter Try If txtFolderToBrowse.Text = "" Then MsgBox("You haven't selected a folder that has MP3 files") txtFolderToBrowse.Focus() Exit Sub End If If VisualBasic.Left(InFolder, 1) <> "\" Then InFolder = InFolder & "\" End If sCurrentPath = Application.StartupPath & "\SongFilesForUpload\" fileName = "MusicFiles_" & Format(Now(), "yyyyMMdd_hhmmss") & ".csv" filePath = Path.Combine(sCurrentPath, fileName) Dim OutFile As String = filePath swFile = New System.IO.StreamWriter(OutFile) sOutput = "Titile,Artist" swFile.WriteLine(sOutput) For Each i As String In Directory.GetFiles(InFolder, "*.mp3") Try sInFile = Path.GetFileName(i) 'Get name of file so that you can get the information MyData = GetMediaData(InFolder & sInFile) sTitle = Replace(Replace(Replace(MyData.Title, ",", ",,"), "&", "&&"), "+", "++") sArtist = Replace(Replace(Replace(MyData.Artist, ",", ",,"), "&", "&&"), "+", "++") sOutput = sTitle & "," & sArtist swFile.WriteLine(sOutput) Catch ex As Exception MsgBox("You Received the following error: " & ex.Message) End Try Next swFile.Close() MsgBox("File has been created. Open folder to review") Catch ex As Exception MsgBox("You Received the following error: " & ex.Message) End Try End Sub
Any help would be greatly appreciated.