Topics: CAB & Smart Client Software Factory
Sep 27, 2005 at 12:15 PM
originally posted by: grsmith

In the LoadCommandMap() method the MainWorkItem is reading the CommandMap from an xml file. What I am trying to do is replace the read with code to build the map. The code is as follows but it blows up on the map.Mapping0.CommandName = because of the dreaded no object has been instantiated.

I am sure this can be done - I have tried all I know about.

CommandMap map = new CommandMap();

map.Mapping0.CommandName = "ShowCustomer";
map.Mapping0.ElementUri = "uie://mainmenu/File/ShowCustomer";
map.Mapping0.Label = "Show Customer";

map.Mapping1.CommandName = "DisableShowCustomer";
map.Mapping1.ElementUri = "uie://mainmenu/File/DisableCustomer";
map.Mapping1.Label = "Disable Show Customer";

map.Mapping2.CommandName = "EnableShowCustomer";
map.Mapping2.ElementUri = "uie://mainmenu/File/EnableCustomer";
map.Mapping2.Label = "Enable Show Customer";

thanks for help
Sep 27, 2005 at 3:07 PM
originally posted by: jwmc

In general, you must allocate individual elements in an array before you access them, i.e.

CommandMap map = new CommandMap();
map.Mapping = new Mapping3;

map.Mapping0.CommandName = "ShowCustomer";