HI all, please bear with me whilst I try to explain what I'm trying to achieve.
We are trying to provide functionality within our existing application for our users to write short programs. The idea is for them to write simple Visual Basic scripts, compile them on the fly and then run the resultant assembly. This side of things is quite simple, and I have runtime compilation and execution working OK - I can make my program display an editor, write some code, run it and make it pop up a box that says "Hello World". Hurray.
My problem / question relates to something similar, but a stage further up the process.
We will provide the user with a TextEditor (most likely CSharpEditor or possibly VSTA or VBExpress) to write the code primarily because of the way in which it can provide code completion / code insight which will greatly assist our users in writing their files. We are looking to simplify the coding process as much as possible since our users are not experienced programmers. The problem I have is this:
Assume we have an object, which I'll call a DataObject. Each DataObject has a series of associated DataTypes. For example, we might have a DataObject:
Dim Bob as DataObject()
Bob = GetDataObject("Bob")
Bob will now have all the various properties associated with a DataObject, such as name, address, email etc. No problem. So our users could write
Bob DOT
and a code completion window would appear and show a list of these properties. Great. Bob also has a list of DataTypes associated to him, for example, "Guarantor", "Supplier" or "Owner". He could be all of them, or none of them. Getting all the DataTypes that are applicable to Bob is no problem:
Dim BobsDTs as DataTypes
BobsDTs = GetDataTypesForDataObject(
Bob)
The question, though, is how would it be possible to, if you like, merge the two objects together, such that each item in BobsDTs would appear as a property of Bob, so that were a user to type
Bob DOT
then they would see a code completion window with the standard properties of a DataObject, but then they would also see the specific DataTypes that apply to Bob.
Obviously I could add a property to DataObject which is a List (Of DataType), but at the point at which the file is being written by the user, they wouldn't have DataObject specific data to work with, just the Properties of a DataType.
I have experimented with creating a string from all applicable DataTypes, which is basically a new class which creates a property for any DataType applicable and then compile at runtime, but I'm not sure how I can then "append" this class / object to Bob. Is there any way of doing this without some heavy duty reflection?
I wonder if that makes any sense.
Any help would be greatly appreciated.
Start Free Trial