Digit number on PropertyGridSpinEditor

1 posts, 0 answers
  1. MaiK
    MaiK avatar
    23 posts
    Member since:
    Mar 2018

    Posted 17 Sep 2018 Link to this post



    I need a PropertyGridSpinEditor with a small difference, it must always show 2 digit. Example: "00", "03", "14"..

    You can see in the image, i have achieved only when the edition has ended with this code.

    Private Sub PropertyGridParams_ItemFormatting(sender As Object, e As UI.PropertyGridItemFormattingEventArgs) Handles PropertyGridParams.ItemFormatting
         If (e.Item.Name = NameOf(PROPNAME)) Then
             DirectCast(e.VisualElement, PropertyGridItemElement).ValueElement.Text = PROP.ToString("00")
          End If
    End Sub


    I try it, but doesnt work.

    Public Class NumericUpDownEditor
        Inherits PropertyGridSpinEditor
        Public Overrides Sub OnValueChanged()
            If (Me.Value.ToString.Length < 2 AndAlso IsNumeric(Me.Value)) Then
                Me.Value = Integer.Parse(Me.Value.ToString()).ToString("00")
            End If
        End Sub
    End Class


    Is there any way to achieve that?


    Thank you!

Back to Top