I am experiencing an extremely odd bug with an application I've created and I cannot figure out why it is doing this...
The application generates weekly reporting stats as Excel files by copying the previous week's file with a new name (ex: 04-06-2009.xls - Monday of the week the stats will be generated for), clears the data within the workbook and inserts the selected week's stats that are pulled from raw data extracts.
This portion of the form contains a date/time picker with the initial value of March 18, 2009, a label, a text box and a button to browse for files if a previous stats file needs to be rebuilt. The date/time picker obviously allows for the user to choose a date for the new file. On the DTP value changed event, it locates the previous week's file and inserts the file path into the label as it's text, generates the new file name and sets the textbox text to that file name.
Expand|Select|Wrap|Line Numbers
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Try
- Control.CheckForIllegalCrossThreadCalls = False
- ' Set the date for the dtpWeeklyExportDate date chooser
- Me.dtpWeeklyExportDate.Value = Date.Today.ToShortDateString()
- Catch ex As Exception
- Me.ToolStripStatusLabel1.Text = ex.Message
- End Try
- End Sub
- Private Sub ExecuteImportToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExecuteImportToolStripMenuItem1.Click
- Progress.ShowDialog()
- End Sub
- Private Sub Progress_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
- Dim strSource As String = Form1.lblWeeklyExportFile.Text
- Dim strDest As String = strSource.Substring(0, Form1.lblWeeklyExportFile.Text.LastIndexOf("\") + 1) & Form1.txtWeeklyNewFileName.Text
- File.Copy(strSource, strDest, True)
- End Sub
Any help would be greatly appreciated!
-Tyler