11Option Strict On
22Option Explicit On
33
4- Imports System.Environment
54Imports System.Drawing
65Imports System.Windows.Forms
6+ Imports ScriptHelp.Scripts
77
88Public Class frmSettings
99
@@ -12,24 +12,29 @@ Public Class frmSettings
1212 My.Settings.Save()
1313
1414 Catch ex As Exception
15- Call ErrorMsg (ex)
15+ ErrorHandler.DisplayMessage (ex)
1616 Exit Try
1717
1818 End Try
1919
2020 End Sub
2121
2222 Private Sub frmSettings_Load(sender As System.Object, e As System.EventArgs) Handles MyBase .Load
23- Call LoadSettings()
24- Call SetFormIcon( Me , My.Resources.Save)
25- Dim strVersion As String = My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & "." & My.Application.Info.Version.Build & "." & My.Application.Info.Version.Revision
26- Me .Text = "Settings for " & My.Application.Info.Title.ToString.Replace( "&" , "&&" ) & Space( 1 ) & strVersion
23+ Try
24+ Call LoadSettings()
25+ Call SetFormIcon( Me , My.Resources.Save)
26+ Dim version As String = My.Application.Info.Version.Major & "." & My.Application.Info.Version.Minor & "." & My.Application.Info.Version.Build & "." & My.Application.Info.Version.Revision
27+ Me .Text = "Settings for " & My.Application.Info.Title.ToString.Replace( "&" , "&&" ) & Space( 1 ) & version
28+
29+ Catch ex As Exception
30+ ErrorHandler.DisplayMessage(ex)
31+ Exit Try
32+
33+ End Try
34+
2735 End Sub
2836
2937 Public Sub LoadSettings()
30- '--------------------------------------------------------------------------------------------------------------------
31- ' Purpose: load settings
32- '--------------------------------------------------------------------------------------------------------------------
3338 Try
3439 Me .pgdSettings.SelectedObject = My.Settings
3540 ''Only show "user" settings
@@ -38,42 +43,23 @@ Public Class frmSettings
3843 'pgdSettings.BrowsableAttributes = attrs
3944
4045 Catch ex As Exception
41- Call ErrorMsg (ex)
46+ ErrorHandler.DisplayMessage (ex)
4247 Exit Try
4348
4449 End Try
4550
4651 End Sub
4752
48- Public Sub SetFormIcon( ByRef frmCurrent As Form, ByRef bmp As Bitmap)
49- '--------------------------------------------------------------------------------------------------------------------
50- ' Purpose: set form icon
51- '--------------------------------------------------------------------------------------------------------------------
53+ Public Sub SetFormIcon( ByRef frmCurrent As System.Windows.Forms.Form, ByRef bmp As Bitmap)
5254 Try
5355 frmCurrent.Icon = Icon.FromHandle(bmp.GetHicon)
5456
5557 Catch ex As Exception
56- Call ErrorMsg (ex)
58+ ErrorHandler.DisplayMessage (ex)
5759 Exit Try
5860
5961 End Try
6062
6163 End Sub
6264
63- Public Sub ErrorMsg( ByRef ex As Exception)
64- '--------------------------------------------------------------------------------------------------------------------
65- ' Global error message for all procedures
66- '--------------------------------------------------------------------------------------------------------------------
67- Dim Msg As String
68- Dim sf As New System.Diagnostics.StackFrame( 1 )
69- Dim caller As System.Reflection.MethodBase = sf.GetMethod()
70- Dim Proc As String = (caller.Name).Trim
71-
72- Msg = "Contact your system administrator." & vbCrLf
73- Msg += "Procedure: " & Proc & vbCrLf
74- Msg += "Description: " & ex.ToString & vbCrLf '
75- MsgBox(Msg, vbCritical, "Unexpected Error" )
76-
77- End Sub
78-
7965End Class
0 commit comments