Groups | Blog | Home
all groups > vb.net upgrade > january 2005 >

vb.net upgrade : VB.Net / VBScript Integration


Jonathan Allen
1/18/2005 1:44:39 PM
With VB6, I stored a lot of user-defined business rules in a database as
VBScript. The VB application would load and run the script as needed. They
were fairly simple, mainly field validation.

Is there a way to do this in VB.Net? (I am willing to use VB.Net instead of
VBScript, so long as I can still store it as clear text rather than in a
compiled form.)

Jonathan

Jonathan Allen
1/18/2005 2:14:00 PM
No, that wouldn't work. The process is...

1. New record is created OR Existing record is opened
2. User inputs changes
3. User hits "Calculate" button. VBScript auto-fills as many fields as it
can.
4. User overrides any values they need to.
5. User hits "Save" button. VBScript validates form.
6. Data is sent to the database.

Each form has its own rules, and those rules change on a regular basis.
(When I say form, I mean it in the generic sense. I have a single VB Form
that uses info in the database to create the form.)

Jonathan


[quoted text, click to view]

Jonathan Allen
1/18/2005 2:46:08 PM
How would I convert....

Sub Calculate
Cost = 47.25 * Hours
End Sub
Function Validate
Validate = (Cost >0) OR (Checkbox2.Checked = True)
End Function

.... into XML?

Jonathan

[quoted text, click to view]

Michael Harris (MVP)
1/18/2005 3:01:38 PM
[quoted text, click to view]

I assume you use the MSScriptControl.ScriptControl to do this from VB6.

You can still use that same COM component via COM interop in VB.Net.

Google Search
http://groups-beta.google.com/groups?q=MSScriptControl.ScriptControl%20%20group:*.dotnet&hl=en&lr=lang_en&num=100&scoring=d


Or you can work out the details of being a VSA host and support scripts
written in VB.Net.

Script Happens .NET
http://msdn.microsoft.com/library/en-us/dnclinic/html/scripting06112001.asp

microsoft.public.dotnet.scripting is the related NG if you go the VSA
route...

--
Michael Harris
Microsoft.MVP.Scripting
Jonathan Allen
1/18/2005 3:27:55 PM
[quoted text, click to view]

Thanks, I think that will work for me.

Jonathan

Chris, Master of All Things Insignificant
1/18/2005 3:56:52 PM
Can you do it as a stored procedure? This seems like a better more
efficient way of going about it.

Chris

[quoted text, click to view]

mr unreliable
1/18/2005 5:40:32 PM
hi Jonathan,

This isn't the answer you asked for, but (my "Dutch Uncle Advice")
forget vbScript, you ought to take a look at xml, which was designed
for exactly what you are doing.

cheers, jw

p.s. In case you haven't tried it, xml is extremely easy to use from vb,
much easier than vbScript. Here are some links:

http://www.thescarms.com/XML/XMLTutorial.asp

http://www.vbwm.com/art_2000/xmlcorner/0902/

http://msdn.microsoft.com/xml/default.aspx


[quoted text, click to view]

AddThis Social Bookmark Button