0
Imports System.IO

Public Class frmRODSelectPage

    Private Sub btnSelectImages_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectImages.Click

        '--------------DECLARE VARIABLES------------------------------------------------------------------------
        Dim FileName As String
        Dim Export As String 'filename only
        Dim DidWork As Integer
        Dim InitialDirectory As String = "E:\Hasbro\CaptureImageFolder\"
        Dim HotFolder As String = "E:\Hasbro\CaptureHotFolder\"
        '--------------END VARIABLES-----------------------------------------------------------------------------


        '--------------EXCEPTION HANDLING------------------------------------------------------------------------
        'If user pushes cancel before selecting file this error displays
        If DidWork = DialogResult.Cancel Then
            Me.Show()
        End If
        '---------------END EXCEPTION HANDLING-------------------------------------------------------------------


        '----------------FILE COPY PROCEDURE---------------------------------------------------------------------
        If OpenFD.ShowDialog = DialogResult.OK Then
            txtShowFileCopy.AppendText(vbNewLine & "----------" & DateAndTime.TimeString & "---------------" & My.User.Name & "----------" & vbNewLine)
            FileName = OpenFD.FileName 'sets file name to the variable FileName
            Export = Path.GetFileName(FileName) 'sends only the filename and extension to the variable export
            For Each selFile As String In OpenFD.FileNames
                Export = Path.GetFileName(selFile) 'sends only the filename and extension to the variable export       
                txtShowFileCopy.AppendText("SUCESSFULLY COPIED ----> " & selFile.ToUpper & vbNewLine) 'displays the files that are being copied in the textbox 
                If Export = "" Or FileName = "" Or HotFolder = "" Then
                    MsgBox("Aw Snap! Something went bad there." & vbNewLine & "Please close the application and try again", MsgBoxStyle.Information, "ERROR WILL ROBINSON!")
                End If
                FileCopy(selFile, HotFolder & Export)
            Next

        End If
        '------------------END FILE COPY------------------------------------------------------------------------
    End Sub


    '----------------------EXIT ROUTINE---------------------------------------------------------------------

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        MsgBox("Are you sure you want to quit?", MsgBoxStyle.YesNo, "Exit Program?")
        System.IO.File.AppendAllText("E:\MILWAUKEE\FlexiCaptureImageFolder\log.txt", txtShowFileCopy.Text)
        Me.Close()
    End Sub

    


    '----------------------END EXIT ROUTINE-----------------------------------------------------------------

    
    Private Sub frmRODSelectPage_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        MsgBox("Are you sure you want to quit?", MsgBoxStyle.YesNo, "Exit Program?")
        System.IO.File.AppendAllText("E:\MILWAUKEE\FlexiCaptureImageFolder\log.txt", txtShowFileCopy.Text)
        Me.Close()
    End Sub
End Class
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by codeorder
1

See if this helps.

'----------------------EXIT ROUTINE---------------------------------------------------------------------
    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close() '// cause app to close.
    End Sub
    '----------------------END EXIT ROUTINE-----------------------------------------------------------------
    Private Sub frmRODSelectPage_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        '// when app. closes, it fires off this event just before it is done and will close.  no need to add Me.Close here.
        MsgBox("Are you sure you want to quit?", MsgBoxStyle.YesNo, "Exit Program?")
        System.IO.File.AppendAllText("E:\MILWAUKEE\FlexiCaptureImageFolder\log.txt", txtShowFileCopy.Text)
    End Sub
Votes + Comments
Excellent response!!!
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.