I am not sure what your Min and Max values refer to.
The following code shows one possible way of doing this and can be added to the MainForm to handle suffix changes for the BasicLabel1 in this example:
Private Sub BasicLabel1_MouseUp(sender As Object, e As MouseEventArgs) Handles BasicLabel1.MouseUp
If e.Button = Windows.Forms.MouseButtons.Right Then
Dim bLabel As AdvancedHMIControls.BasicLabel = DirectCast(sender, AdvancedHMIControls.BasicLabel)
Dim lblMin, lblMax, lblSuffix As New System.Windows.Forms.Label
Dim tbMin, tbMax, tbSuffix As New System.Windows.Forms.TextBox
Dim btnOK As New System.Windows.Forms.Button
Dim f = New System.Windows.Forms.Form
f.StartPosition = FormStartPosition.CenterScreen
f.Size = New Size(288, 260)
f.Text = "Change Min/Max/Suffix"
f.AcceptButton = btnOK
f.TopMost = True
lblMin.Location = New Point(25, 37)
lblMin.Font = New Font("Microsoft Sans Serif", 14)
lblMin.Text = "Min:"
lblMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight
lblMax.Location = New Point(25, 69)
lblMax.Font = New Font("Microsoft Sans Serif", 14)
lblMax.Text = "Max:"
lblMax.TextAlign = System.Drawing.ContentAlignment.MiddleRight
lblSuffix.Location = New Point(25, 104)
lblSuffix.Font = New Font("Microsoft Sans Serif", 14)
lblSuffix.Text = "Suffix:"
lblSuffix.TextAlign = System.Drawing.ContentAlignment.MiddleRight
tbMin.Size = New Size(100, 20)
tbMin.Location = New Point(130, 37)
tbMin.Font = New Font("Microsoft Sans Serif", 12)
tbMin.ReadOnly = False
tbMax.Size = New Size(100, 20)
tbMax.Location = New Point(130, 69)
tbMax.Font = New Font("Microsoft Sans Serif", 12)
tbMax.ReadOnly = False
tbSuffix.Size = New Size(100, 20)
tbSuffix.Location = New Point(130, 104)
tbSuffix.Font = New Font("Microsoft Sans Serif", 12)
tbSuffix.ReadOnly = False
btnOK.Size = New Size(81, 37)
btnOK.Location = New Point(87, 162)
btnOK.Text = "OK"
f.Controls.Add(lblMin)
f.Controls.Add(lblMax)
f.Controls.Add(lblSuffix)
f.Controls.Add(tbMin)
f.Controls.Add(tbMax)
f.Controls.Add(tbSuffix)
f.Controls.Add(btnOK)
AddHandler btnOK.Click, Sub()
Try
'Add here code to handle Min and Max changes
'This line will change suffix if new one is entered
If Not String.IsNullOrEmpty(tbSuffix.Text) Then bLabel.ValueSuffix = tbSuffix.Text
f.Close()
f.Dispose()
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
f.Show()
End If
End Sub
A new form will only show up on the right-click of the mouse.
Do note that if the PLCAddressKeypad field is populated then this right-click of the mouse will also show the Keypad itself.
In order to prevent this and limit the Keypad show only with the left-click of the mouse, update the following Sub inside the BasicLabel code:
'***********************************************************
'* If label is clicked, pop up a keypad for data entry
'***********************************************************
Protected Overrides Sub OnClick(e As System.EventArgs)
MyBase.OnClick(e)
If e.GetType = GetType(System.Windows.Forms.MouseEventArgs) Then
Dim mea As System.Windows.Forms.MouseEventArgs = e
If mea.Button.ToString = "Left" Then
If m_PLCAddressKeypad IsNot Nothing AndAlso (String.Compare(m_PLCAddressKeypad, "") <> 0) And Enabled Then
ActivateKeypad()
End If
End If
End If
End Sub
Make any changes to the code as you see it fit for your purpose.