When the standard new button is called, the form code populates a list of the tables that were inherited from the data source's table. If the main table is abstract, it is not added to the list. Once the user selects an option, a map is initialized. The key is the data source name, while the value is the table name to be created. The following table shows this:
User-selected option | Map->key | Map->value |
Vehicles | ConVMSVehicleTable | ConVMSVehicleTable |
Trucks | ConVMSVehicleTable | ConVMSVehicleTableTruck |
Bikes | ConVMSVehicleTable | ConVMSVehicleTableBike |
Cars | ConVMSVehicleTable | ConVMSVehicleTableCar |
Then, it calls the form's createTypes method with this map, where the map will contain one element per data source, which essentially means one element. The form then calls the data source's create method, where the data source's buffer has been instantiated with the selected inherited table, such as ConVMSVehicleTableBike.
We are simply hooking into this process by populating the map with the desired option based on the vehicle type.
You can test this by adding breakpoints to the methods and see for yourself what is called and when. To do this, use the Debug | Attach to process option and select the w3wp process. You will need to check the Show processes from all users box in order to see this process.