Print Page | Close Window

Format not immediate

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=2028
Printed Date: 09 May 2024 at 12:27pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Format not immediate
Posted By: bluelizard
Subject: Format not immediate
Date Posted: 24 March 2005 at 3:59pm
When you change the numeric format of PropertyGridItem using Format function, the change is not immediately applied to the number (type Double).  If you edit the value or set the value after code, then the format is applied.  Should be applied when Format string changes too.

To duplicate in VB6, place PropertyGrid on Form1 and add the Form_Load code.

Private Sub Form_Load()
    Dim pi As Double
    pi = Atn(1) * 4
       
    Dim fmt As String
    fmt = "%0.9f"
   
    Dim pgiCat As PropertyGridItem
    Set pgiCat = PropertyGrid1.AddCategory("Category")
    pgiCat.Expanded = True
   
    Dim pgiChild As PropertyGridItem
    Set pgiChild = pgiCat.AddChildItem(PropertyItemDouble, "Child", pi)
    pgiChild.Format = fmt  'this doesn't display right away
   
    Dim pgiNext As PropertyGridItem
    Set pgiNext = pgiCat.AddChildItem(PropertyItemDouble, "Next", Null)
    pgiNext.Value = pi
    pgiNext.Format = fmt 'this doesn't display right either
   
    Dim pgiSibling As PropertyGridItem
    Set pgiSibling = pgiCat.AddChildItem(PropertyItemDouble, "Sibling", 0)
    pgiSibling.Format = fmt
    pgiSibling.Value = pi       'this displays correctly.
End Sub




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net