473,398 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 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 1986
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.