Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <appSettings>
- <add key="LastZHRverzamelPDF" value="C:xpdf filesTestPDF.pdf" />
- <add key="LastMapSplitted" value="C:xpdf filesZHRFORMS" />
- <add key="LastPersFile" value="C:xpdf filesPersoneelslijst.xlsx" />
- <add key="LastMap1" value="C:xpdf filesSalarisslips" />
- <add key="LastMap2" value="C:xpdf filesVakantie-uren" />
- <add key="LastMap3" value="C:xpdf filesZHRFORMS" />
- <add key="LastMap4" value="C:xpdf filesLogitime" />
- <add key="ClientSettingsProvider.ServiceUri" value="" />
- </appSettings>
- Private Sub Form1_Load(sender As System.Object, e As EventArgs) Handles MyBase.Load
- Try
- 'Laatstgekozen waarden uit app.config halen en in lbls neerzetten
- lblZHRFile.Text = ConfigurationManager.AppSettings("LastZHRverzamelPDF").ToString()
- lblMapSplitted.Text = ConfigurationManager.AppSettings("LastMapSplitted").ToString() & ""
- lblPersFile.Text = ConfigurationManager.AppSettings("LastPersFile").ToString()
- lblMap1.Text = ConfigurationManager.AppSettings("LastMap1").ToString() & ""
- lblMap2.Text = ConfigurationManager.AppSettings("LastMap2").ToString() & ""
- lblMap3.Text = ConfigurationManager.AppSettings("LastMap3").ToString() & ""
- lblMap4.Text = ConfigurationManager.AppSettings("LastMap4").ToString() & ""
- Catch ex As Exception
- Dim exMsg As String = "Message: " & ex.Message & vbCrLf & "Source: " & ex.Source & vbCrLf & "StackTrace: " & ex.StackTrace
- MsgBox(exMsg, MsgBoxStyle.Information, "Sub Form1_Load")
- Dim errormsg As String = ex.Message
- End Try
- End Sub
- Private Sub btnZHRPath_Click(sender As Object, e As EventArgs) Handles btnZHRPath.Click
- Try
- Dim fd As OpenFileDialog = New OpenFileDialog()
- fd.FileName = ConfigurationManager.AppSettings("LastZHRverzamelPDF").ToString()
- Dim strFileName As String
- With fd
- .Title = "Selecteer verzamel-PDF file ZHRFORMS uit SAP"
- .InitialDirectory = ""
- .Filter = "All files (*.pdf)|*.pdf|All files (*.pdf)|*.pdf"
- .FilterIndex = 2
- .RestoreDirectory = True
- End With
- If fd.ShowDialog() = DialogResult.OK Then
- strFileName = fd.FileName
- lblZHRFile.Text = strFileName
- Dim objConfig As Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
- objConfig.AppSettings.Settings("LastZHRverzamelPDF").Value = strFileName
- objConfig.Save(ConfigurationSaveMode.Modified)
- ConfigurationManager.RefreshSection("appSettings")
- Else
- lblZHRFile.Text = "(overslaan)"
- End If
- Catch ex As Exception
- Dim exMsg As String = "Message: " & ex.Message & vbCrLf & "Source: " & ex.Source & vbCrLf & "StackTrace: " & ex.StackTrace
- MsgBox(exMsg, MsgBoxStyle.Information, "btnZHRPath_Click")
- End Try
- End Sub
- Private Sub btnSplittedPath_Click(sender As Object, e As EventArgs) Handles btnSplittedPath.Click
- Try
- If sender = Nothing Then MsgBox("nullsender")
- lblMapSplitted.Text = "C:" 'ConfigurationManager.AppSettings("LastMapSplitted").ToString() & ""
- Dim Map As FolderBrowserDialog = New FolderBrowserDialog
- Map.SelectedPath = ConfigurationManager.AppSettings("LastMapSplitted").ToString()
- Map.Description = "Selecteer doelmap voor gesplitte PDF-files"
- Map.ShowNewFolderButton = True
- Dim DoelMap As String = ""
- If Map.ShowDialog() = Windows.Forms.DialogResult.OK Then
- DoelMap = Map.SelectedPath & ""
- Dim objConfig As Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
- objConfig.AppSettings.Settings("LastMapSplitted").Value = Map.SelectedPath
- objConfig.Save(ConfigurationSaveMode.Modified)
- ConfigurationManager.RefreshSection("appSettings")
- Else
- DoelMap = "(overslaan)"
- End If
- lblMapSplitted.Text = DoelMap
- Catch ex As Exception
- Dim exMsg As String = "Message: " & ex.Message & vbCrLf & "Source: " & ex.Source & vbCrLf & "StackTrace: " & ex.StackTrace
- MsgBox(exMsg, MsgBoxStyle.Information, "btnSplittedPath_Click")
- End Try
- End Sub
- Private Sub btnFilePath_Click(sender As Object, e As EventArgs) Handles btnFilePath.Click
- Dim fd As OpenFileDialog = New OpenFileDialog()
- Dim strFileName As String
- fd.FileName = ConfigurationManager.AppSettings("LastPersFile").ToString()
- With fd
- .Title = "Selecteer bestand met medewerkergegevens"
- .InitialDirectory = ""
- .Filter = "All files (*.xl*)|*.xl*|All files (*.xl*)|*.xl*"
- .FilterIndex = 2
- .RestoreDirectory = True
- End With
- If fd.ShowDialog() = DialogResult.OK Then
- strFileName = fd.FileName
- lblPersFile.Text = strFileName
- Dim objConfig As Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
- objConfig.AppSettings.Settings("LastPersFile").Value = strFileName
- objConfig.Save(ConfigurationSaveMode.Modified)
- ConfigurationManager.RefreshSection("appSettings")
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement