Create ActiveView(AxPbd) Component fully programmatically

Discussion created by sovain on Apr 17, 2012
Latest reply on Apr 20, 2012 by hanyong


Hi Colleagues,

I spent quite a lot of time and probably somebody can help me with a problem.

In C# Application Form I need to create an AciveView Component (AxPbd) for showing some trends.

It works perfect when I just add it from a ToolBar and set the DisplayURL when compile time. I can then add trends programmatically in the predefined on a form Component (AxPbd) with DisplayURL  - hardcoded.

The problem is that I cannot change the DisplayURL programmatically, in fact I can but after that I cannot add any trends on a display object:

PBObjLib.Display Trend1Display_Fill;

Trend1Display_Fill = axPbd1.Display as PBObjLib.Display;


MyTrend_Fill = (PBSymLib.Trend)Trend1Display_Fill.Symbols.Add(PBObjLib.pbSYMBOLTYPE.pbSymbolTrend);


It says that the object Trend1Display_Fill not an instance of object (it is just null )

Can somebody example  C#-code  how to dinamically create this component  and add trends on it as well as change DisplayURL - programmatically.


The piece of code is beneath.


Thanks for paying attention to that




AxHost _pbDisplay = new AxPBDCtrl.AxPbd();


_pbDisplay.Name = "axPbd1";




IntPtr forceCreation = _pbDisplay.Handle;


_pbDisplay.Dock = DockStyle.None;


AxPBDCtrl.AxPbd axPbd1 = (AxPBDCtrl.AxPbd)_pbDisplay;


axPbd1.DisplayURL = @"C:\Projects\trend.pdi";


_pbDisplay.Enabled = true;