Hi,
I have created a form and placed a UltraWinGrid and UltraGridExcelExporter on it. In order to meet my needs I have initialized the form so I could place it in a panel as a control . Everthing works great, the grid funtions fine in the panel on the form.
Now I want to execute the UltraGridExcelExporter from the form that hosts the panel from a menu on a UltraToolBarManger. Is this possible? I tried to call the UltrGridExcelExporter using the controls class of the panel;
Me.Panel.FormThatIsAControl.Controls.UltraToolBarManger1.Export()
This didn't work.
Thanks
Adam
I'm afraid that I don't follow your code; there is no Export method on the toolbars manager as far as I am aware. You need to call the Export method on the UltraGridExcelExporter component itself.
-Matt
My mistake, I typed the incorrect code in my example, here is the code I am attempting to use;
Me.Panel.FormThatIsAControl.Controls.UltraGridExcelExporter.Export() ,
I think that you are a little confused on the object model that is provided by the various object. The ControlsColletion class does not have a property called "FormThatIsAControl", so the compiler will throw an error. It does not know that it should walk through the Controls collection looking for a control of that name, or type, because it has no information about what that object should be or what its type is. Similarly, 'FormThatHostsPanel', if that's the name of the form, does not have a public property defined on its class that returns a grid.
What you might need to do is reference the ControlsCollection by the name of the control (i.e. form.Controls["UltraWinGrid1"]) and cast that to an UltraGrid type. Alternatively you could create a class that derives from Form and exposes a public property called Grid that knows that it should look into the Controls collection for the grid.
What's the error that you are getting? You need to pass in the grid to the Export method as well, but without more information on what your problem is, I'm not able to point you in the right direction.