Home > Posts > Converting a VB6 form to an ASP.net WebForm

Converting a VB6 form to an ASP.net WebForm

See my opensource VB6toWebForm tool at http://zoomicon.com/tranxform

It converts a VB6 form’s design to XML (eXtended Markup Language) via my VB6FormDesignToXML tool that you can also find on that site, and then via XSL (eXtended Stylesheet Transformations) it converts that XML into ASP.net 1.x WebForm pages (using classic vertical flow layout based on the tab-order from the VB6 form and making sure labels that have been assigned to edit controls stay on the same line as those controls)

If you use ASP.net 2.x, VS.net has a nice import wizard (which won’t convert the coding style of those 1.x pages [e.g. the usage of a single codebehind file without using a partial class – a concept that .NET1.x didn’t support], but will tweak them to work fine with ASP.net 2.x)

If you add to the XSL transformations files logic to handle more VB6 controls, please consider contributing your enhancements to the tranXform project

BTW, more free XML related utilities are on that website


if you get a transformation error, please open up WebForm.xsl in XSL subfolder and replace | with or (with small letters). Seems MSXML engine stopped supporting | in test expressions and needs or instead. Will look into uploading a newer version.

Categories: Posts Tags:
  1. 2015/10/15 at 18:57

    Dear George,
    I was excited finding your VB6FormToWebForm on the Internet.
    What an ingenious way to help me transform my VB6 application to the Web!
    However, running the utility produced an error in XLSTransform:

    Converting Criteria.frm to Criteria.frm.aspx and Criteria.frm.aspx.vb
    Transformation error: Expression must evaluate to a node-set.
    Converting MDIVraag2.frm to MDIVraag2.frm.aspx and MDIVraag2.frm.aspx.vb
    Press any key to continue . . .

    1. Is there a way for me to avoid the error, perhaps by changing the form?
    2. How can I include MDIForms in the XLS-files?

    Is there a way to send you the forms by email?
    Hope you find a solution to my problem, it will save me tons of work!
    Kind regards,
    Tom van Leeuwen

    • 2015/10/15 at 19:49

      Hi Tom,
      it has been some time since I last touched that code, but I think the message “Transformation error: Expression must evaluate to a node-set” is one I’ve seen before. Must have to do with change to MSXML engine that the tool I have there to apply the XSL uses. Probably can use newer tool (had one in Delphi and there’s another one from Microsoft) that you can find in some of my newer transformation utilities (see which one uses XML+XSL). If can’t find it, I’ll look for it at other projects of mine that use XSL transformation to send it to you.

      So give it a look and let me know. If you want you can send me at my @zoomicon.com e-mail (add my surname in front of it) some forms to try the code

      btw, make sure you first refactor the original forms to add tab order to them and also before that to add group boxes where needed to group stuff together at the output (don’t need to have a visible border/label to such groupboxes, can just use them for grouping stuff)

      • 2015/10/15 at 19:59

        now that I look at it again, I see that at http://zoomicon.com/tranxform the XSLer and XSLTransform tool downloads are quite old (older that the VB6FormToWebForm download). However at the http://aroe.gr/content/en/about.html site folder I have locally (the site is generated using XML+XSL), I see an XSLTranform.exe with 2014 date that also has an Mvp.Xml.dll in it (Microsoft MVP XML library), that I think I had used to fix that issue with newer MSXML engine. Probably forgot to update the XSLTransform tool download (and also the VB6FormToWebForm to use the new one)

    • 2015/10/15 at 20:42

      Hi again Tom, found the issue, just open up WebForm.xsl in XSL subfolder and replace | with or (with small letters). Seems back then MSXML supported | in test expressions, but doesn’t anymore

      The older XSLTransform.exe that is in the Util folder seems to work OK, don’t need the newer one (just tried in Win10). If you see other issues though let me know. Will try to find sometime to update all this stuff and maybe move to CodePlex

  2. 2015/10/16 at 00:21

    Hi George,
    That seemed to do the trick, thank you so much!
    However I cannot transform a MDIForm to a WebForm.
    Any idea what I should change where?
    I will send you an MDIForm by mail.
    Thank you in advance.
    Best regards,
    Tom van Leeuwen

  3. 2015/10/16 at 07:54

    BTW, just remembered what was the change at the newer XSLTransform.exe tool that I have forgotten to update at my transformation tools collection at http://zoomicon.com/tranxform – the newer version was using Mvp.Xml.dll in order to add support for XInclude. However it isn’t really needed to be updated at VB6FormToWebForm conversion, since I’m not using any XInclude there (used to merge multiple XML documents).

  4. 2015/10/16 at 15:10

    MDI Form uses the class VB.MDIForm instead of VB.Form, so I had to do some changes to the stylesheets. I’ve also done some other enhancements like using UTF-8 in the stylesheets and using the latest XSLTransform.exe tool I was mentioning above to force MSXML to output indented HTML etc. Will send you a new version via e-mail and see into updating the site with it

  5. 2015/10/16 at 15:34

    (copying that e-mail text here, since it may be useful to others too)

    Note that at the .aspx.vb you may get several empty lines for non-recognized components, you may need to update the stylesheets to add what you want to be output for them

    The concept is that you detect components by classname and spit out the properties you care about (like the label of a Button) by reading in values of related properties of the original form (which have VB6 names/values). This work is done in the XSL files, one is for outputing the .frm.aspx and one for the .frm.aspx.cs

    In the process.bat you’ll find a command that deletes the .frm.xml file produced in the main folder during processing. You may want to comment out that del command (use :del … or REM del …) in order to see that file. It’s of a very simple format, its definition is in the .dtd file (XML Document Type Definition / DTD) in the main folder. That XML is produced by the VBFormDesignToXML tool, after the form design part is extracted from the .frm file using the tool VBFormDesignFilter (the code part of the .frm can be extracted using the tool VBFormCodeFilter)

    In a more advanced version, copying of event handling and other auxiliary methods from original .frm file with property renaming could be implemented. Also parsing of binary property values (like images) stored in the .frx file (now only an frx reference is placed in the .aspx file say for an image source). Not sure if there is any third party tool btw to extract resources from .frx and maybe convert image blobs from there (maybe stored in .bmp or .ico or some headerless form, not sure) to more standard formats like .png.

    Please contribute any updates you make by sending them via e-mail (till I put this up as a git repository on CodePlex). If anyone is interested to fund further development of this opensource project, do let me know.

    My original plan was to also add Delphi form conversion and why not WinForms one etc. In fact I believe all such forms’ design part could be converted to a generic XML format that would allow to convert to any other specific form (e.g. VB6 form -> VB6 form XML -> generic/portable form XML -> Delphi XML -> Delphi form)

  1. No trackbacks yet.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: