Home All Groups Group Topic Archive Search About

beyond dynamic code execution

Author
15 Oct 2005 3:40 PM
George Meng
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.
(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.



Following is the chart for this question:

This is a Normal Winform

This is my dream:
.. Add a new button "Print Invoice" (I know how to do)
.. The Button has a "click event"   (I know how to do)
.. The code for "click event" comes from database, need to be recomplied (I know how to do)
.. Most important: The code should access ListBox control ( and maybe other controls) to get current selected item.( I don't know how to do)

Thanks for any suggestions.

George Meng

Author
15 Oct 2005 3:49 PM
George Meng
To make it more clearly,

". Add a new button "Print Invoice" (I know how to do)
.. The Button has a "click event"   (I know how to do)
.. The code for "click event" comes from database, need to be recomplied (I know how to do)"
are all done by the form itself, not by visual studio.

  "George Meng" <georgemeng2***@sohu.com> дÈëÏûÏ¢ÐÂÎÅ:OF4YQ7Z0FHA.3***@TK2MSFTNGP10.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.
  (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.



  Following is the chart for this question:

  This is a Normal Winform

  This is my dream:
  . Add a new button "Print Invoice" (I know how to do)
  . The Button has a "click event"   (I know how to do)
  . The code for "click event" comes from database, need to be recomplied (I know how to do)
  . Most important: The code should access ListBox control ( and maybe other controls) to get current selected item.( I don't know how to do)

  Thanks for any suggestions.

  George Meng
Author
15 Oct 2005 3:59 PM
Ken Halter
"George Meng" <georgemeng2***@sohu.com> wrote in message
news:OF4YQ7Z0FHA.3152@TK2MSFTNGP10.phx.gbl...
> I got a tough question:

From the looks of that form, this looks like a .Net question.

You'll want to post that in a .Net group. They all contain "dotnet" or
"vsnet" in their names.
This and all other groups on the MS server that start with
"microsoft.public.vb" are for VB Classic (VB versions 1-6) and were in
existance long before any .Net products were released. While some of the
code looks the same, they are very different products and require a
different set of groups.

Try one of these:
news://microsoft.public.dotnet.general
news://microsoft.public.dotnet.languages.vb

A couple of tips when you get there.

Post plain text and dump the pictures.

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..