0

Ive wrote a small program to open at startup, but i want to give the user a chance to delete it from showing on startup by clicking a button. But it needs to be compatible on XP, Vista and Windows 7. Is there a line of code which will get the default startup folder path automatically so i can then delete it using my button?

Thankyou in advance,

Ross

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by rosstafarian
Featured Replies
  • cheers guys. I found it elsewhere. here is the code i used if anyone needs it [CODE] Dim startupfolder As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup) Dim path As String = startupfolder & "\" & "testing.txt" Try If System.IO.File.Exists(path) = True Then System.IO.File.Delete(path) MsgBox("File Deleted") Else MsgBox("File Not Deleted") End If Catch ex … Read More

1

cheers guys. I found it elsewhere. here is the code i used if anyone needs it

Dim startupfolder As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup)
        Dim path As String = startupfolder & "\" & "testing.txt"

        Try
            If System.IO.File.Exists(path) = True Then

                System.IO.File.Delete(path)
                MsgBox("File Deleted")
            Else
                MsgBox("File Not Deleted")
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
Votes + Comments
thanks for provided solution:)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.