I have an application that I am creating that will dynamically read in the assembly and class name of a particular object I want and create an instance of it, so that I may assign and use it's unique properties. This works great, however, I now want to house the .vb (class files) in a resource folder and read them in and create instance of them from there so that I can use their properties, instead of adding the classes into my project for each new item I need. This will allow me to easily add new items on the fly. The current code I am using reads in the values from an XML file:
Dim theList = LoadExportXML(aPersist.GetType().ToString())
Dim thefootername As String = ""
Dim thefooternamespace As String = ""
For Each theParent As XmlNode In theList
If theParent.Attributes("hasfooter").Value = "Y" Then
' get delimiter
thefootername = theParent.Attributes("footername").Value
thefooternamespace = theParent.Attributes("footernamespace").Value
Dim thefooter As BaseFooter
Dim thetype = Type.GetType(thefootername & "," & thefooternamespace)
thefooter = Activator.CreateInstance(thetype)
thefooter.DocumentNumber = aPersist.DocumentNumber
thefooter.TotalPrice = TotalPrice
thefooter.TotalQty = TotalQty
thefooter.TotalRecords = TotalRecords
thefooter.NumberOfCartons = NumberOfCartons
How do I do the same thing above, but read in the class file from a known directory?