BUG: Application Fails When You Check TreeView Node Before the TreeView Control Is Displayed (283019)



The information in this article applies to:

  • Microsoft Visual J++ 6.0

This article was previously published under Q283019

SYMPTOMS

When you call the setChecked(true) method on a TreeView node, the call may fail if the TreeView control has not yet been displayed.

CAUSE

This problem occurs because the control is not created until it is displayed.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. In Visual J++ 6.0, create a new Windows application.
  2. Add a TabControl to the form, and create two TabPages. To create TabPages, follow these steps:
    • In the Properties window, select the tabs property.
    • In the TabPage[] Editor window, create two TabPages.
  3. In the second TabPage, add a TreeView control and a few CheckBox nodes. To create CheckBox nodes, follow these steps:
    • In the Properties window, change the CheckBoxes property to true.
    • Select the nodes property.
    • In the TreeNode Editor window, add two root nodes.
  4. In the first TabPage, add two buttons.
  5. Add two button event handlers to programmatically call the setChecked method as follows:
    private void button1_click(Object source, Event e)
      {
         TreeNode treenode = treeView1.getNode(0);
         treenode.setChecked(true);
      }
    
      private void button2_click(Object source, Event e)
      {
         TreeNode treenode = treeView1.getNode(0);
         treenode.setChecked(false);
      }
    					
  6. Run the application. You cannot use the buttons on the first TabPage to control the state of the check box items in the TreeView control on the second TabPage.

    However, when you select the second TabPage to bring the TreeView control into view when the application comes up, you can use the buttons on the first TabPage to control the state of the check box items.

REFERENCES

For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

Modification Type:MajorLast Reviewed:6/14/2006
Keywords:kbBug kbnofix kbWFC KB283019