Advertisement
Guest User

Untitled

a guest
Apr 25th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. <appSettings>
  2. <add key="LastZHRverzamelPDF" value="C:xpdf filesTestPDF.pdf" />
  3. <add key="LastMapSplitted" value="C:xpdf filesZHRFORMS" />
  4. <add key="LastPersFile" value="C:xpdf filesPersoneelslijst.xlsx" />
  5. <add key="LastMap1" value="C:xpdf filesSalarisslips" />
  6. <add key="LastMap2" value="C:xpdf filesVakantie-uren" />
  7. <add key="LastMap3" value="C:xpdf filesZHRFORMS" />
  8. <add key="LastMap4" value="C:xpdf filesLogitime" />
  9. <add key="ClientSettingsProvider.ServiceUri" value="" />
  10. </appSettings>
  11.  
  12. Private Sub Form1_Load(sender As System.Object, e As EventArgs) Handles MyBase.Load
  13. Try
  14.  
  15. 'Laatstgekozen waarden uit app.config halen en in lbls neerzetten
  16. lblZHRFile.Text = ConfigurationManager.AppSettings("LastZHRverzamelPDF").ToString()
  17. lblMapSplitted.Text = ConfigurationManager.AppSettings("LastMapSplitted").ToString() & ""
  18.  
  19. lblPersFile.Text = ConfigurationManager.AppSettings("LastPersFile").ToString()
  20. lblMap1.Text = ConfigurationManager.AppSettings("LastMap1").ToString() & ""
  21. lblMap2.Text = ConfigurationManager.AppSettings("LastMap2").ToString() & ""
  22. lblMap3.Text = ConfigurationManager.AppSettings("LastMap3").ToString() & ""
  23. lblMap4.Text = ConfigurationManager.AppSettings("LastMap4").ToString() & ""
  24.  
  25. Catch ex As Exception
  26. Dim exMsg As String = "Message: " & ex.Message & vbCrLf & "Source: " & ex.Source & vbCrLf & "StackTrace: " & ex.StackTrace
  27. MsgBox(exMsg, MsgBoxStyle.Information, "Sub Form1_Load")
  28. Dim errormsg As String = ex.Message
  29.  
  30. End Try
  31.  
  32. End Sub
  33.  
  34. Private Sub btnZHRPath_Click(sender As Object, e As EventArgs) Handles btnZHRPath.Click
  35. Try
  36. Dim fd As OpenFileDialog = New OpenFileDialog()
  37. fd.FileName = ConfigurationManager.AppSettings("LastZHRverzamelPDF").ToString()
  38. Dim strFileName As String
  39.  
  40. With fd
  41. .Title = "Selecteer verzamel-PDF file ZHRFORMS uit SAP"
  42. .InitialDirectory = ""
  43. .Filter = "All files (*.pdf)|*.pdf|All files (*.pdf)|*.pdf"
  44. .FilterIndex = 2
  45. .RestoreDirectory = True
  46. End With
  47. If fd.ShowDialog() = DialogResult.OK Then
  48. strFileName = fd.FileName
  49. lblZHRFile.Text = strFileName
  50. Dim objConfig As Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
  51. objConfig.AppSettings.Settings("LastZHRverzamelPDF").Value = strFileName
  52. objConfig.Save(ConfigurationSaveMode.Modified)
  53. ConfigurationManager.RefreshSection("appSettings")
  54. Else
  55. lblZHRFile.Text = "(overslaan)"
  56. End If
  57. Catch ex As Exception
  58. Dim exMsg As String = "Message: " & ex.Message & vbCrLf & "Source: " & ex.Source & vbCrLf & "StackTrace: " & ex.StackTrace
  59. MsgBox(exMsg, MsgBoxStyle.Information, "btnZHRPath_Click")
  60.  
  61. End Try
  62. End Sub
  63.  
  64. Private Sub btnSplittedPath_Click(sender As Object, e As EventArgs) Handles btnSplittedPath.Click
  65.  
  66. Try
  67. If sender = Nothing Then MsgBox("nullsender")
  68. lblMapSplitted.Text = "C:" 'ConfigurationManager.AppSettings("LastMapSplitted").ToString() & ""
  69.  
  70. Dim Map As FolderBrowserDialog = New FolderBrowserDialog
  71. Map.SelectedPath = ConfigurationManager.AppSettings("LastMapSplitted").ToString()
  72. Map.Description = "Selecteer doelmap voor gesplitte PDF-files"
  73. Map.ShowNewFolderButton = True
  74. Dim DoelMap As String = ""
  75. If Map.ShowDialog() = Windows.Forms.DialogResult.OK Then
  76. DoelMap = Map.SelectedPath & ""
  77. Dim objConfig As Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
  78. objConfig.AppSettings.Settings("LastMapSplitted").Value = Map.SelectedPath
  79. objConfig.Save(ConfigurationSaveMode.Modified)
  80. ConfigurationManager.RefreshSection("appSettings")
  81. Else
  82. DoelMap = "(overslaan)"
  83. End If
  84. lblMapSplitted.Text = DoelMap
  85. Catch ex As Exception
  86. Dim exMsg As String = "Message: " & ex.Message & vbCrLf & "Source: " & ex.Source & vbCrLf & "StackTrace: " & ex.StackTrace
  87. MsgBox(exMsg, MsgBoxStyle.Information, "btnSplittedPath_Click")
  88.  
  89. End Try
  90. End Sub
  91.  
  92. Private Sub btnFilePath_Click(sender As Object, e As EventArgs) Handles btnFilePath.Click
  93.  
  94. Dim fd As OpenFileDialog = New OpenFileDialog()
  95. Dim strFileName As String
  96. fd.FileName = ConfigurationManager.AppSettings("LastPersFile").ToString()
  97. With fd
  98. .Title = "Selecteer bestand met medewerkergegevens"
  99. .InitialDirectory = ""
  100. .Filter = "All files (*.xl*)|*.xl*|All files (*.xl*)|*.xl*"
  101. .FilterIndex = 2
  102. .RestoreDirectory = True
  103. End With
  104. If fd.ShowDialog() = DialogResult.OK Then
  105. strFileName = fd.FileName
  106. lblPersFile.Text = strFileName
  107. Dim objConfig As Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
  108. objConfig.AppSettings.Settings("LastPersFile").Value = strFileName
  109. objConfig.Save(ConfigurationSaveMode.Modified)
  110. ConfigurationManager.RefreshSection("appSettings")
  111. End If
  112.  
  113. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement