Results 1 to 10 of 10

Thread: Modifying code at runtime?

  1. #1

    Thread Starter
    Addicted Member danielkw's Avatar
    Join Date
    Mar 2000
    Location
    Sweden
    Posts
    134

    Modifying code at runtime?

    Is there any way I can modify a procedure at code-level at runtime? Purpose of this would be maybe insert/execute Vb-code written in a textbox or something

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Why would you do that ? Are you really out of thoughts and can't write that code and compile it . I mean , you need to build your own compiler .

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    It'll probably be easier to load the code you need from a compiled assembly and just have the procedure dynamically choose from that what to execute. This is pretty standard plugin type activity. What specifically are you having trouble with?

  4. #4

    Thread Starter
    Addicted Member danielkw's Avatar
    Join Date
    Mar 2000
    Location
    Sweden
    Posts
    134
    No the thing is that I am writing an application where the users will be able to write their own mathematical algorithms. I've done this in vb6 and there I used vbscript through Microsoft Script Control. Using this control it's easy to evaluate and execute code written in a textbox. The problem is I can't use this component in .NET so I am thinking of another way. Are you getting my problem correct?

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Sorry I've never tried this before but why don't you import this component and use in .NET ?

  6. #6

    Thread Starter
    Addicted Member danielkw's Avatar
    Join Date
    Mar 2000
    Location
    Sweden
    Posts
    134
    as i just said, I can't. i get the message "Assebmly could not be converted"...

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    How did you try and add the control? I just added it to a project and it went fine. You should be adding it to the Toolbox on the left hand side. Right click on the tab you want to put it in and click 'Add/Remove Items...'. Then switch to the COM Components tab and check the box next to the 'ScriptControl Object'. Then hit ok and it will be in the Toolbox and from there it should work like any other control.

  8. #8

    Thread Starter
    Addicted Member danielkw's Avatar
    Join Date
    Mar 2000
    Location
    Sweden
    Posts
    134
    yeah, adding it to the toolbox works fine but try placing it on a form. I get an error message saying:
    "Converting the library to a .NET assebmly failed. Exception from HRESULT: 0x80131019"

  9. #9
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Hmm still worked fine for me. I added one to my form and there was no trouble. I didn't actually try using it for anything but the app did compile with one sitting on the form. This may also help:

    http://getdotnetco.web101.discountas...wnloadPage.htm

  10. #10

    Thread Starter
    Addicted Member danielkw's Avatar
    Join Date
    Mar 2000
    Location
    Sweden
    Posts
    134
    thanks for the download! that example works fine. i wonder why my dll doesn't work. it still works in vb6. I might just use the dll shipped in the zip instead.!

    thank you!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width