473,695 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2012
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******** *****@TK2MSFTNG P15.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******** *****@TK2MSFTNG P15.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******** *****@TK2MSFTNG P15.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
CompilerParamet ers.ReferencedA ssemblies 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******** ******@TK2MSFTN GP15.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******** *****@TK2MSFTNG P15.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
CompilerParamet ers.ReferencedA ssemblies 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******** ******@TK2MSFTN GP15.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******** *****@TK2MSFTNG P15.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
2958
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 not, are there any plans to add support for it in the future? What other popular programming languages support dynamic programming? --The Directive
7
6284
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 SELECT * FROM SALES WHERE CUSTOMER_ID=12345 Oracle will replace 12345 with a parameter SELECT * FROM SALES WHERE CUSTOMER_ID=:SYS_0 then it will provide 12345 (there is a very convenient setting CURSOR_SHARING just for that). Next time a similar query...
3
9640
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 see no problems and think the app is running okay. I turned a database monitor on the app and see that the database is getting SQL return coes of -301 for a variety of database accesses (some times the same access works, okay other times -301)....
2
2065
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. Then I want to store the C# code in a database. I found an example explaining how to do a sum of 100 numbers. What I didn't understand was the way to generalize it's use.
6
2669
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 dynamic SQL string using a class builder. The pros I can see are: It reduces the number of stored procs to admin. Changes to the underlying table schema does not require massive changes to
0
2068
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab, System and Software Engineering Lab), ULB (deComp) and the Belgian Association for Dynamic Languages (BADL) are very pleased to invite you to a whole day of presentations about the programming languages Self, Smalltalk and Common Lisp by experts in...
12
2445
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 will distill it here. The core of his argument started with his statement: "There is no gain in performance, maintainability or otherwise by implementing the Dispose method if unmanaged resources are not involved." I focused particularly on...
7
3021
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 proper tier to put it since is a data function But then I've heard that writing SQL in my client .NET code might run just as fast? Dynamic SQL or something? And then there's LINQ on the horizon. Is it a successor to everything
6
7967
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, there is a ETL which deletes most of the data in the database and fills it all new. We observed very bad performance for some statements that ran for minutes (The queried table is about 100,000 records and the result is about 500 rows)....
0
8565
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9113
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8977
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8822
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4339
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2997
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2269
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1971
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.