Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - Format not immediate
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Format not immediate

 Post Reply Post Reply
Author
Message
bluelizard View Drop Down
Newbie
Newbie
Avatar

Joined: 24 March 2005
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote bluelizard Quote  Post ReplyReply Direct Link To This Post Topic: Format not immediate
    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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.