I need to create a WinForms application with a custom VB script editor that would allow the user to manipulate values in an underlying datatable. The user would have access to the datafields in the underlying table through the editor and could create custom variables to perform calculations and apply assumptions. The editor would provide read/write access to the underlying data (assume the datatable was populated from an MS Access database) and need runtime language and syntax support. The form would have a RichTextBox as the editor with buttons to support the initialization of the Script; Preview the update datatable in datagridview; and accept changes on the underlying datatable
Below is a quick example of what i picture the user script looking like:
For Each dr As DataRow In DataTable 'assume dr is a loan and DataTable is a portfolio of loans
Dim dBal As Double, dRate As Double, dInterestPmt As Double 'user defined variables
dBal = dr("Balance").Value 'Balance is a field in the datatable
dRate = dr("Rate").Value 'Rate is a field in the datatable
'calculate interest payment
dInterestPmt = dBal * dRate / 12
dr("InterestPmt").Value = dInterestPmt 'Update value for InterestPmt field in datatable
Next
The calculations get much more complicated thats why i am not going the SQL route. I was thinking one way to do this is load a datatable, pass the values to a Class where each field is a property and expose it to the editor that way, granted i have no idea how to do that but thought it was an option.
Question:
How would i go about creating a tool like this? Are there any thrid party tools that already do this? I have searched Google for some time on this topic and have found nothing useful. I know there is documentation out there on the script editor part but not for the purposes i have scribed. Any help would be much appreciated.
Thanks,
Jason