It's not overwriting the old object, it is creating a new object each time the custom action is invoked so you can't save state like this. A better approach would be to write the object's data into a custom table. When you need to create the collection, iterate through the rows in the table, create the object from the data you read and add the object to the collection.
Hope this helps. -f -----Original Message----- From: danimian [mailto:miand...@gmail.com] Sent: Thursday, October 08, 2009 1:58 AM To: wix-users@lists.sourceforge.net Subject: [WiX-users] Problem while creating objects by calling custom action Hi, i am writing a custom action with following code, creating an object. It is Working well. Actually this custom action must create many objects too if user want to create many (by clicking save button many time and calling custom action everytime). The problem is, it is overwriting old object and not coming with all (new and old objects) in AddDatabaseToCollection. using Microsoft.Deployment.WindowsInstaller; [CustomAction] public static ActionResult ObjCA(Session session) { DBInformation obj_PDBInformation = new PDBInformation(); obj_DBInformation.DisplayName = session["DISPLAYEDITPROP"]; DBConfigurator.AddDatabaseToCollection(obj_DBInformation); return ActionResult.Success; } <Property Id="DISPLAYPROP"></Property> <CustomAction Id="CreateCA" BinaryKey="ObjCA" DllEntry="ObjCA"/> <Binary Id="ObjCA" SourceFile="SaveInformation.dll" /> Here using giving input: <Control Id="DisplayName" Type="Edit" X="110" Y="60" Width="150" Property="DISPLAYPROP" Height="15" Text="{80}" /> Save Button to call the custom action (CreateCA): <Control Id="Save" Type="PushButton" X="110" Y="200" Width="46" Height="17" Text="&Save"> <Publish Event="DoAction" Value="CreateCA">1</Publish> What i am missing in code? Or How to solve this type of task? Any help would be highly appreciated. Thanks in advance. Best Regards Adnan -- View this message in context: http://n2.nabble.com/Problem-while-creating-objects-by-calling-custom-action -tp3786813p3786813.html Sent from the wix-users mailing list archive at Nabble.com. ---------------------------------------------------------------------------- -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users