.Net Script Editor (C#,Vb.net Mini IDE)

Complete Visual Studio IDE (source code included) in single user contol that can be used in your windows application to provide scripting feature in languages like c# abd vb.net.IDE have features like code intellisence,reference to .Net assemblies,COM libraries & web services.The code editor supports lot coloring for languages like c,c++ c#,vb.net,sql etc..Refrectoring features like converting c# code to vb.net code in single click.

Add scripting functionality to your application,features of MS Script control (Functions like AddObject) and some features of VSA/Visual Studio editor like intellisence, code completion etc. Mini .Net IDE in single winform control.

The source code / article published here is to provide features of MS Script control (Functions like AddObject) and some features of VSA/Visual Studio editor like intellisence, code completion etc. The control supports C# and VB.net language however can be easily modified to support any .net language. You can use COM references, .Net references & Web References. The control supports Visual studio IDE features like bookmark, highlighting interpreter errors & compiler errors, adding multiple classes and interfaces. You can imagine visual studio IDE build in single control with feature like AddObject from MS Script Control. To use this control you just need to drag and drop it to your winforms and add few lines of code to add instance of object which you want to access in the scripts.

Source code at :

10 thoughts on “.Net Script Editor (C#,Vb.net Mini IDE)

  1. Hi Rajneesh – I am looking for a scripting extension to my platform. I came across your article and found it very helpful. Still not clear though, whether to go the VSA way or the Script Control way for this project. If I were to scope out this project to integrate an existing scripting base with a better editor (intellisense, context sensitive help, bracket matching etc.) – what would be the best way to go about doing it?Best regards – Susmit {shaltrade (at) gmail.com}


  2. VSA supports .Net language.like VBA support vb.6 language. If you are using vbscript and it is sufficient for your application you may choose VBA (It would be easy to migrate your existing script) – VBA is included with MS word or Excel.However if want to port you application scripts to .Net plateform you may choose VSA.VSA editors also support intelisence for javascript…


  3. Rajneesh,

    You have managed to put together a rather impressive start for a nice control to provide script editing, compilation and execution.

    I previously found the article on CodeProject for this control and downloaded the source for evaluation, as I am looking to provide C# scripting as an extension for an application I have been working on. In playing with the source code and the sample application that is included, it appears that the posted code was in more of a prototype stage of development with a solid framework in place, but missing some key pieces. The project explorer for instance does not appear to allow opening of an existing source file or saving of the project (and by extension closing a project or opening a new project). I also note that the control throws a number of exceptions while performing simple script editing such as on the insertion of the following string “if (” and exception is thrown when the “(” is input, or if you move your caret to an empty line and insert a space an exception is thrown.

    Adding the additional functionality is not so difficult of course, nor is the fixing of the exceptions that are thrown. However, I am curious if you have continued to work on this control since the article was posted on CodeProject and if there happens to be a more recent version (possibly using newer versions of the code from which certain pieces were derived)?

    Thanks for the contribution.




  4. CREO
    The control was developed as part of POC to implement script editor like you have in SQL Server SSIS package. There are lot of more important features like debugging with break points which are not implemented in the source code. With all the features (except visual designers) this control is somewhere near to Visual Studio IDE. The question here is “What would you choose if you have scripting requirement in your application and you have two choices one to go with this code and further development of few months or choose Microsoft VSA  with all the features and integrate this in your application?” I would recommend Microsoft VSA until unless you are going to develop (product) control to replace VSA.
    I have stopped working on this project however i have something in the pipe to build the web based scripting editor control specifically in Silverlight or WPF., where i am going to use most of classes from this project specifically code compilation and completion providers over WCF consumed by Silverlight VSA IDE …I will definitely share the code / architecture on my blog..


  5. From code-project, I interested about scripting in .net framework. My background is from VB6. Now our company asked to porting into VB.NET 2005 In VB6, we use MSSCRIPT control happily on scripting. In VB6 we use MSSCRIPT to customize all of the control’s properties in a form. Example: a Form named as Form1, contains 2 TextBox, named as Text1 and Text2, also contains CommandButton named as Button1 Usually, In VB6 we just passing Form1 to MSSCRIPT then we customize all of the control’s properties of the form. like as in VBScript code as shown : With form1 .text1.text = “HELLO” .text2.maxlength = 10 end with very easy doing scripting using MSSCRIPT in VB6. The problem comes when I learn in VB.NET 2005 What should we choose for scripting? Seems lots of choices as MSSCRIPT (COM based) or CodeDom or VSA or VSTA? I try to searching lots of article/tutorial about scripting in 3 months but haven’t meets as simple as doing scripting in VB6. Would mind to suggest or help about scripting in >NET? Please give me as simple way to scripting in .NET? The big problem is it’s not as easy as in VB6, able to passing the form (container) so all of the controls in a form can be derrived. If possible to do in VB.NET 2005, please shown me example of above cases in VB6. Please advice and thanks in advance.


    1. If you are not looking for scripting editor then their is no point to go for VSA etc.

      I assume in your application you have Textbox control where you write your script and pass the contents to MsScript Control and execute the script.You are using AddObject method of msscript control to pass named objects to your script.

      In dot net this can be achived by removing the editor or UI part from the project “ScriptControl” . In dot net every program run inside an Application Domain , what you want to achive here is to create a new assembly at runtime and load into appdomain and execute it and then unload. The problem here is you can’t unload an assembly once it gets loaded into appdomain. The way is to load your assembly into seprate appdomain, communicate with two appdomains using remoting and then unload the temp. appdomain. This is implemented in the source of script control (project: ScriptEngine class : Engine.cs),project ScriptRun is used for communication between two app domains.

      You need to extract some code related to AddObject and Code generation and execution from Project : ScriptControl, class Scriptcontrol.cs .

      Basically you need to create User control which is invisible at run time like MSScriptControl.

      The script control project was written in C# and i would suggest to create control in c# to save lot of time. Once the control is available and tested you can use it in your VB.Net project.


  6. I look at the code and I can’t find where to add new function completion. I want to add more function to vb.net language..
    let’s if I type myProgram. after i press . key i want to show all my custom functions like if I press String. will appear all function.
    can someone help me ?


  7. Hi Rajneesh,
    really great control. Exactly what I need.
    There is just some kind of a resize bug. I am using your control with visual studio 2010. I  have compiled the Test example insight the source code. Depending on the width of my window the scrollbar and the project window are not visible. In fullscreen mode I can see the last 2 or 3 pixel of the scrollbar. Sometimes the resizing works as it should. It seems that sometimes the width of the control is much to high.
    I made a console output of the ClientRectangle and I can see that the width of the ClientRect is not correct.
    Let’s say I can see the scrollbar and then begin resizing my window (just the width). The width of clientrect gets smaller and smaller and suddenly the scrollbar disappear and the width jumps from 750 to 1020 again.
    I am not sure where to look for the resizing, since you are doing a lot of layout stuff in all the controls…
    Can you help me with this?
    Many Thanks,


  8. Hi Peter,
    It has been long time back when i had worked on this control and it would be difficult for me to spare more time on this as i am busy with silverlight libraries.I haven’t tested this control much as this was developed for some poc. Make sure you remove all bugs before you publish into production.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s