-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathModernDemo.bas
88 lines (57 loc) · 2.26 KB
/
ModernDemo.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Attribute VB_Name = "ModernDemo"
Option Compare Database
Option Explicit
Public Sub ErrorDemo()
Const Topic As String = "Example error"
Dim Test As Integer
Dim Message As String
On Error GoTo Err_ErrorDemo
Test = 1 / 0
Exit_ErrorDemo:
Exit Sub
Err_ErrorDemo:
Message = ErrorMox(Topic)
Debug.Print Message
Resume Exit_ErrorDemo
End Sub
Public Sub HelpDemo()
Const Prompt As String = "Press Help"
Const Buttons As Long = vbQuestion + vbOKCancel + vbMsgBoxHelpButton
Const Title As String = "Help Demo"
Const HelpFile As String = "c:\test\samplehelp.chm"
Const Context As Long = 2
Dim Result As VbMsgBoxResult
Result = MsgMox(Prompt, Buttons, Title, HelpFile, Context)
' Close the help window, should it have been opened.
CloseHelp
' Or call CloseHelp before exiting the application.
Debug.Print Result
End Sub
Public Sub ModernDemo()
Const Prompt1 As String = "What do you wish to tell the World?"
Const Default As String = "Hello!"
Const Buttons As Long = vbOKCancel + vbInformation + vbDefaultButton2
Const Title1 As String = "Modern/Metro Input Box"
Const Title2 As String = "Modern/Metro Message Box"
Dim Message As String
Message = InputMox(Prompt1, Title1, Default)
MsgMox Message, Buttons, Title2
End Sub
Public Sub NativeDemo()
Const Prompt1 As String = "What do you wish to tell the World?"
Const Default As String = "Hello!"
Const Buttons As Long = vbOKCancel + vbInformation + vbDefaultButton2
Const Title1 As String = "Boring Input Box"
Const Title2 As String = "Boring Message Box"
Dim Message As String
Message = InputBox(Prompt1, Title1, Default)
MsgBox Message, Buttons, Title2
End Sub
Public Sub ThanksDemo()
Const Prompt As String = "No further reading." & vbCrLf & "Proceed on your own, please."
Const Buttons As Long = vbCritical + vbOKCancel
Const Title As String = "Thank You"
Dim Result As VbMsgBoxResult
Result = MsgMox(Prompt, Buttons, Title)
Debug.Print Result
End Sub