472,978 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,978 software developers and data experts.

beyond dynamic code execution

I got a tough question:

The backgroud for this question is:
I want to design an application works like a engine.
After release, we can still customize a form by adding a button, and source
code for the button. (This is done by the form itself, not by using VS.Net)
(button and source code should be a record in database, these information
should be retrieve from database when the form shows up)

What I want is:
I want the source code (comes from database) to access other controls which
has already been in the form. For example:
I want to read a item from a listbox (let's assume there is a listbox in
the form)
I want to add a item to a listbox
I want to change the property of a datagrid
.......

What I can to do:
1) add a button on the fly
2) load source code from database for this button's click event
3) complie code on the fly.

What I don't know:
I don't knwo how to reference the form in the new code.
I don't know how to reference the controls in the form.

Thanks for any suggestions.

George Meng
Nov 21 '05 #1
8 1959
George,

You are not the first one who asks questions related to your approach in
this newsgroup.

Microsoft did it already and after long time of continuous improvement they
have now the current version of Office MS Access. It did cost Microsoft a
lot of money to come where they are now.

You will have to go that way as well. In my opinion is it asking to much
from a newsgroup to give the solution for that.

Keep in mind that your customers normaly will accept nothing less than a
solution as MS Access.

Just meant as warning to think about before you start.

Cor
Nov 21 '05 #2
Not sure what you are talking about.
I am using .Net, have nothing to do with Access.
I a short, my question is: how to reference other objects in a new dynamic
execution code.

George

"Cor Ligthert [MVP]" <no************@planet.nl> 写入消息新闻
:eV**************@TK2MSFTNGP14.phx.gbl...
George,

You are not the first one who asks questions related to your approach in
this newsgroup.

Microsoft did it already and after long time of continuous improvement they have now the current version of Office MS Access. It did cost Microsoft a
lot of money to come where they are now.

You will have to go that way as well. In my opinion is it asking to much
from a newsgroup to give the solution for that.

Keep in mind that your customers normaly will accept nothing less than a
solution as MS Access.

Just meant as warning to think about before you start.

Cor

Nov 21 '05 #3
George,
| What I don't know:
| I don't knwo how to reference the form in the new code.
| I don't know how to reference the controls in the form.
The "easiest" way may be to define the dynamic code as inheriting from your
form. Alternatively you could define your dynamic code as accepting a
parameter of your form.

Thinking about it: the Separated Interface Pattern might be useful here.

http://www.martinfowler.com/eaaCatal...Interface.html
I would put the form or separated interface in its own class library, then
when I compile the dynamic code I would add a reference to the class
library.

I will see if I can come up with an example tomorrow.

Some questions:
- Is the definition of the form static? (other then the button you are
adding?)
- How is the dynamic code defined? (Is it a sub, function, class, something
else?)
- Is Code Access Security involved?
- How many buttons w/code can be added to a form? (

I believe Cor was referring to "full integration" where the users of your
app have complete control to customize the UI as Access does. You may want
to consider a product such as Microsoft Visual Studio 2005 Tools for
Applications if you are looking for significant user customization of your
UI.

http://msdn.microsoft.com/vstudio/ex...a/default.aspx
--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net
"George Meng" <ge************@sohu.com> wrote in message
news:ej*************@TK2MSFTNGP15.phx.gbl...
|I got a tough question:
|
| The backgroud for this question is:
| I want to design an application works like a engine.
| After release, we can still customize a form by adding a button, and
source
| code for the button. (This is done by the form itself, not by using
VS.Net)
| (button and source code should be a record in database, these information
| should be retrieve from database when the form shows up)
|
| What I want is:
| I want the source code (comes from database) to access other controls
which
| has already been in the form. For example:
| I want to read a item from a listbox (let's assume there is a listbox in
| the form)
| I want to add a item to a listbox
| I want to change the property of a datagrid
| ......
|
| What I can to do:
| 1) add a button on the fly
| 2) load source code from database for this button's click event
| 3) complie code on the fly.
|
| What I don't know:
| I don't knwo how to reference the form in the new code.
| I don't know how to reference the controls in the form.
|
| Thanks for any suggestions.
|
| George Meng
|
|
Nov 21 '05 #4
George,
Another question.

Is there only one form that you can add dynamic code to or are there
multiple forms that you add dynamic code to?

--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net
"George Meng" <ge************@sohu.com> wrote in message
news:ej*************@TK2MSFTNGP15.phx.gbl...
|I got a tough question:
|
| The backgroud for this question is:
| I want to design an application works like a engine.
| After release, we can still customize a form by adding a button, and
source
| code for the button. (This is done by the form itself, not by using
VS.Net)
| (button and source code should be a record in database, these information
| should be retrieve from database when the form shows up)
|
| What I want is:
| I want the source code (comes from database) to access other controls
which
| has already been in the form. For example:
| I want to read a item from a listbox (let's assume there is a listbox in
| the form)
| I want to add a item to a listbox
| I want to change the property of a datagrid
| ......
|
| What I can to do:
| 1) add a button on the fly
| 2) load source code from database for this button's click event
| 3) complie code on the fly.
|
| What I don't know:
| I don't knwo how to reference the form in the new code.
| I don't know how to reference the controls in the form.
|
| Thanks for any suggestions.
|
| George Meng
|
|
Nov 21 '05 #5
Thanks very much Jay, actually, I want to put this feature into multiple
forms.
"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> 写入消息新闻
:eu**************@TK2MSFTNGP15.phx.gbl...
George,
Another question.

Is there only one form that you can add dynamic code to or are there
multiple forms that you add dynamic code to?

--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net
"George Meng" <ge************@sohu.com> wrote in message
news:ej*************@TK2MSFTNGP15.phx.gbl...
|I got a tough question:
|
| The backgroud for this question is:
| I want to design an application works like a engine.
| After release, we can still customize a form by adding a button, and
source
| code for the button. (This is done by the form itself, not by using
VS.Net)
| (button and source code should be a record in database, these information | should be retrieve from database when the form shows up)
|
| What I want is:
| I want the source code (comes from database) to access other controls
which
| has already been in the form. For example:
| I want to read a item from a listbox (let's assume there is a listbox in | the form)
| I want to add a item to a listbox
| I want to change the property of a datagrid
| ......
|
| What I can to do:
| 1) add a button on the fly
| 2) load source code from database for this button's click event
| 3) complie code on the fly.
|
| What I don't know:
| I don't knwo how to reference the form in the new code.
| I don't know how to reference the controls in the form.
|
| Thanks for any suggestions.
|
| George Meng
|
|

Nov 21 '05 #6
Jay,

I believe Cor was referring to "full integration" where the users of your
app have complete control to customize the UI as Access does. You may want
to consider a product such as Microsoft Visual Studio 2005 Tools for
Applications if you are looking for significant user customization of your
UI.
Exactly

:-)

http://msdn.microsoft.com/vstudio/ex...a/default.aspx

Exactly

:-)

Cor
Nov 21 '05 #7
George,
I sounds like you want an Add-in/Plug-in ability where the code is
dynamically compiled, rather then loaded from a pre-compiled assembly.

The following articles discusses loading plug-ins into AppDomains
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

The following article discusses some security to using AddDomains:
http://msdn.microsoft.com/msdnmag/is...s/default.aspx
The following discusses what's new in CAS in .NET 2.0
http://msdn.microsoft.com/msdnmag/is...y/default.aspx

The following discuss what's new in .NET 2.0 for loading plug-ins into
AppDomains
http://msdn.microsoft.com/msdnmag/is...s/default.aspx
When you compile your dynamic code you can use
CompilerParameters.ReferencedAssemblies to reference the assembly with your
application's "object model" in it. I would make this "object model"
"hardened" as the above article articles suggest. Although using AppDomains
& an "hardened object model" is more work, it helps your app be more
resilient to problems in the dynamic code.

NOTE: You will need to compile the dynamic code in the sand boxed AppDomain
to ensure its isolated...

--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net
"George Meng" <ge************@sohu.com> wrote in message
news:Og**************@TK2MSFTNGP15.phx.gbl...
| Thanks very much Jay, actually, I want to put this feature into multiple
| forms.
|
|
| "Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net>
写入消息新闻
| :eu**************@TK2MSFTNGP15.phx.gbl...
| > George,
| > Another question.
| >
| > Is there only one form that you can add dynamic code to or are there
| > multiple forms that you add dynamic code to?
| >
| > --
| > Hope this helps
| > Jay [MVP - Outlook]
| > T.S. Bradley - http://www.tsbradley.net
| >
| >
| > "George Meng" <ge************@sohu.com> wrote in message
| > news:ej*************@TK2MSFTNGP15.phx.gbl...
| > |I got a tough question:
| > |
| > | The backgroud for this question is:
| > | I want to design an application works like a engine.
| > | After release, we can still customize a form by adding a button, and
| > source
| > | code for the button. (This is done by the form itself, not by using
| > VS.Net)
| > | (button and source code should be a record in database, these
| information
| > | should be retrieve from database when the form shows up)
| > |
| > | What I want is:
| > | I want the source code (comes from database) to access other controls
| > which
| > | has already been in the form. For example:
| > | I want to read a item from a listbox (let's assume there is a listbox
| in
| > | the form)
| > | I want to add a item to a listbox
| > | I want to change the property of a datagrid
| > | ......
| > |
| > | What I can to do:
| > | 1) add a button on the fly
| > | 2) load source code from database for this button's click event
| > | 3) complie code on the fly.
| > |
| > | What I don't know:
| > | I don't knwo how to reference the form in the new code.
| > | I don't know how to reference the controls in the form.
| > |
| > | Thanks for any suggestions.
| > |
| > | George Meng
| > |
| > |
| >
| >
|
|
Nov 21 '05 #8
Thanks so much Jay, I got the direction. I will try it.

"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> 写入消息新闻
:eo**************@TK2MSFTNGP15.phx.gbl...
George,
I sounds like you want an Add-in/Plug-in ability where the code is
dynamically compiled, rather then loaded from a pre-compiled assembly.

The following articles discusses loading plug-ins into AppDomains
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

The following article discusses some security to using AddDomains:
http://msdn.microsoft.com/msdnmag/is...s/default.aspx
The following discusses what's new in CAS in .NET 2.0
http://msdn.microsoft.com/msdnmag/is...ity/default.as
px
The following discuss what's new in .NET 2.0 for loading plug-ins into
AppDomains
http://msdn.microsoft.com/msdnmag/is...s/default.aspx
When you compile your dynamic code you can use
CompilerParameters.ReferencedAssemblies to reference the assembly with your application's "object model" in it. I would make this "object model"
"hardened" as the above article articles suggest. Although using AppDomains & an "hardened object model" is more work, it helps your app be more
resilient to problems in the dynamic code.

NOTE: You will need to compile the dynamic code in the sand boxed AppDomain to ensure its isolated...

--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net
"George Meng" <ge************@sohu.com> wrote in message
news:Og**************@TK2MSFTNGP15.phx.gbl...
| Thanks very much Jay, actually, I want to put this feature into multiple
| forms.
|
|
| "Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net>
写入消息新闻
| :eu**************@TK2MSFTNGP15.phx.gbl...
| > George,
| > Another question.
| >
| > Is there only one form that you can add dynamic code to or are there
| > multiple forms that you add dynamic code to?
| >
| > --
| > Hope this helps
| > Jay [MVP - Outlook]
| > T.S. Bradley - http://www.tsbradley.net
| >
| >
| > "George Meng" <ge************@sohu.com> wrote in message
| > news:ej*************@TK2MSFTNGP15.phx.gbl...
| > |I got a tough question:
| > |
| > | The backgroud for this question is:
| > | I want to design an application works like a engine.
| > | After release, we can still customize a form by adding a button, and
| > source
| > | code for the button. (This is done by the form itself, not by using
| > VS.Net)
| > | (button and source code should be a record in database, these
| information
| > | should be retrieve from database when the form shows up)
| > |
| > | What I want is:
| > | I want the source code (comes from database) to access other controls | > which
| > | has already been in the form. For example:
| > | I want to read a item from a listbox (let's assume there is a listbox | in
| > | the form)
| > | I want to add a item to a listbox
| > | I want to change the property of a datagrid
| > | ......
| > |
| > | What I can to do:
| > | 1) add a button on the fly
| > | 2) load source code from database for this button's click event
| > | 3) complie code on the fly.
| > |
| > | What I don't know:
| > | I don't knwo how to reference the form in the new code.
| > | I don't know how to reference the controls in the form.
| > |
| > | Thanks for any suggestions.
| > |
| > | George Meng
| > |
| > |
| >
| >
|
|

Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: The Directive | last post by:
Does C++ support dynamic programming? I hope I'm using the correct term. I want to write code that can dynamically rewrite itself! I want to dynamically create functions and call them and etc. If...
7
by: Ford Desperado | last post by:
there is an application which issues a lot of simple dynamic queries against an Oracle database. If CURSOR_SHARING is set to FORCE, Oracle treats dynamic queries as static ones, for instance...
3
by: JDPope | last post by:
I have a situation which I cannot get a good lead on how to resolve. One of the applications I support uses the Hibernate software to generate SQL. The app is JAVA with JDBC. In testing the users...
2
by: JC | last post by:
Hello, I'm looking for examples of how to make dynamic creation of code and dynamic execution of the same code. I want to do some code dynamically and then I want to use it to get some results....
6
by: MattC | last post by:
Hi, I'm implementing a new Business Layer in one of our applications. I'm toying with the idea of placing all the Create, Read, Update and Delete SQL in the object in question and build a...
0
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab,...
12
by: Cordell Lawrence \(News Group\) | last post by:
There an ongoing discussion between a colleague and myself about the usefulness of the IDisposable pattern beyond the reclamation of unmanaged resources. The discussion is somewhat lengthy so I...
7
by: Ronald S. Cook | last post by:
I've always been taught that stored procedures are better than writing SQL in client code for a number of reasons: - runs faster as is compiled and lives on the database server - is the more...
6
by: =?ISO-8859-1?Q?Tim_B=FCthe?= | last post by:
Hi, we are building a Java webapplication using JSF, running on websphere, querying a DB2 9 on Suse Enterprise 10. The app uses JDBC and PreparedStatements only (aka dynamic SQL). Every night,...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.