Which of the following code segments should you use?

You have added a SplitContainer control named Certkiller SplitContainer to a form. You then left the control to the default properties. To the right-most container of the SplitContainer control, you need to add a PropertyGrid. Which of the following code segments should you use?

You have added a SplitContainer control named Certkiller SplitContainer to a form. You then left the control to the default properties. To the right-most container of the SplitContainer control, you need to add a PropertyGrid. Which of the following code segments should you use?

A.
PropertyGrid propertyGrid = new PropertyGrid[];
Panel rightPanel = [Panel] Certkiller SplitContainer.GetContainerControl[];
rightPanel.ControlAdd[porpertyGrid];

B.
PropertyGrid propertyGrid = new PropertyGrid[];
Panel rightPanel = [Panel] Certkiller SplitContainer.GetNextControl[propertyGrid, true];
rightPanel.ControlAdd[porpertyGrid];

C.
PropertyGrid propertyGrid = new PropertyGrid[];
Certkiller SplitContainer.Container.Add[propertyGrid, "RightPanel"];

D.
PropertyGrid propertyGrid = new PropertyGrid[];
Certkiller SplitContainer.Panel2.Control.Add[propertyGrid];

Explanation:
An area can be divided into two containers, which is separated by a movable bar, if you use the SplitContainer control. When the two Panels are created, the left one is the Panel1 and the right is Panel2. You are adding a panel so it will be on the right. You then need to specify Panel2.

Incorrect Answers:
A, B, C: You should not use the Add method of the SplitContainer.Container to add the PropertyGrid. You also should not pass a PropertyGrid instance to the GetNextControl method to return a Panel instance. This will actually retrieve the next tab-ordered control given the current control. You also should not call the GetContainerControl method to return a Panel instance. This will return the logical container of the SplitContainer control.



Leave a Reply 0

Your email address will not be published. Required fields are marked *