A couple of new properties could also be created to allow enabling/disabling the passcode requirement and setting the passcode itself:
Private m_KeypadRequestPasscode As Boolean
Public Property KeypadRequestPasscode As Boolean
Get
Return m_KeypadRequestPasscode
End Get
Set(value As Boolean)
m_KeypadRequestPasscode = value
End Set
End Property
Private m_KeypadPasscode As String = "1234"
Public Property KeypadPasscode() As String
Get
Return m_KeypadPasscode
End Get
Set(ByVal value As String)
m_KeypadPasscode = value
End Set
End Property
and then also modify Archie's code in the OnClick sub to:
If m_KeypadRequestPasscode Then
'* Make a keypad popup asking for a passcode
Dim PassCodeKeypad As New MfgControl.AdvancedHMI.Controls.Keypad(m_KeypadWidth)
PassCodeKeypad.StartPosition = Windows.Forms.FormStartPosition.CenterScreen
PassCodeKeypad.ForeColor = Color.Red
PassCodeKeypad.Text = "P A S S C O D E"
PassCodeKeypad.ShowDialog()
If PassCodeKeypad.DialogResult = DialogResult.Cancel Then
Exit Sub
End If
If PassCodeKeypad.Value <> m_KeypadPasscode Then
MsgBox("Invalid pass code!")
Exit Sub
End If
End If
These modifications could be added to any control that has Keypad.