Here is a useful hint when you are not sure how to code something that can be done in the designer, such as adding a DataSubscriver2 and adding PLCAddressItems to it.
First you add the item to a form in designer like you would normally do. Then in Solution Explorer at the top you will see an icon for Show All Files, select that icon. Now you can drill down into your form and you will see a file with the form name and appended to it is designer.vb . This is the code that Visual Studio has written for you when you added the items to the designer. Open that file and scroll down until you see where it sets the properties for the item (DataSubscriber in this case). You will see how to write the code to do the task.
For the DataSubscriber2 you are not going to see what would you expect, so it may not be very useful. I will explain why not.... In some cases Visual Studio will write out all of the code and in other cases it will put things into a resource file, which is the case for a PLCAddressItem. Now if you look at Solution Explorer you will also see a file with the name of the form and an extension of resx. This is where the resources are stored. You can double click that to see the resources. When it first opens you still will not see your PLCAddressItems. In the resource display the first drop down selection at the top is probably set to String. You will need to change that to Other.
Now that I explained a bunch of stuff that is not completely useful, I will tell you the answer you were looking for.
The PLCAddressItem is an object, so you need to create a new instance in order to add it to the PLCAddresValueItems of the DataSubscriber2. Fortunately there is a constructor that takes parameters directly to make this easy:
MfgControl.AdvancedHMI.Drivers.PLCAddressItem("40001", 1)
So now you can use that to create the instance and add it to the DataSubscriber like this:
ds21.Add(New MfgControl.AdvancedHMI.Drivers.PLCAddressItem("40001", 1))
Now let me jump back to the Visual Studio designer code and tell you where it is important.... If you look toward the top of the code, you will find this line of code:
CType(Me.DataSubscriber21, System.ComponentModel.ISupportInitialize).BeginInit()
This code is important because the DataSubscriber implements an interface called ISupportInitialize. The purpose of the is to let the DataSubscriber set all of its properties before it starts trying to subscribe to the driver. You can think of calling BeginInit as a "pause". To remove the "pause", you will need to call EndInit. Visual Studio handles any kind of object and must adapt so it adds the Ctype() which in your case you will not need.
So here is the final required code to add items to the DataSubscriber2:
ds21.BeginInit()
ds21.Add(New MfgControl.AdvancedHMI.Drivers.PLCAddressItem("40001", 1))
ds21.EndInit()