NetAccess 2.2
NetAccess 2.2 is available since
October 2008.
It contains a number of productivity enhancements to allow you to use NetAccess more efficiently and more rapidly with Visual Studio 200x.
Please read the
NetAccess Release History for more details.
Description
NetAccess allows you to write C# DLLs and to use them from third parties development systems like APL+Win, exactly as if they were ActiveX.
This means that, with NetAccess, you can write a C# DLL, "prepare" it to be used by products like APL+Win, compile it and then use it as if it were an ActiveX, using
ŒWI.
This also means, with NetAccess, APL+Win users will now be able to exploit the full power of the .Net Framework and its thousands of classes.


Prerequisites
To be able to use NetAccess, you need:
- APL+Win v6.4 (or later)
- Microsoft Visual Studio 2005 or Visual Studio 2008
You do not need to know how to use Visual Studio or know how to program with C#: a 100 pages detailed documentation full of examples, teaches you on a step by step basis, how to write a DLL in C# and how to prepare it so that it can be used as an ActiveX from APL+Win.
What was new in NetAccess 2.0 
Here are the NetAccess v2.0 enhancements:
- Syntax Coloring
- the C# generated code is now syntax colored (with the same default colors as used by Visual Studio 2005)
- Grid Colors
- the Properties, Methods and Events grids now use colors
- Automatic Link to the Visual Studio C# Source File
- a new field and button lets you link the current NetAccess project to the corresponding Visual Studio C# file
- 2-way C# Code Changes Detection Between the NetAccess RichEdit Control and the NetAccess Grids
- all changes you make to the NetAccess Properties, Methods and Events grids are automatically reflected in the C# code
- all changes you make to the C# code are automatically reflected in the NetAccess Properties, Methods and Events grids
- 2-way C# Code Changes Detection Between NetAccess and Visual Studio 2005
- when you change and save C# code in NetAccess, Visual Studio automatically detects the changes and prompts you to load the NetAccess version of the file
- when you change and save C# code in Visual Studio, NetAccess automatically detects the changes and prompts you to load the Visual Studio version of the file
- C# Code Preservation
- NetAccess now preserves C# code you may have written under Visual Studio
- This means that you can work back and forth between NetAccess and Visual Studio without losing code even though code is generated every time you make changes under NetAccess.
- Automatic C# Code Adjustment and Generation from Changes in Properties, Methods and Events Grids
- NetAccess now uses more than 100 regular expressions to perform automatic and secure adjustments to the generated C# code whenever you add, remove, rename properties, methods, events, arguments, etc. through the various NetAccess grids
- Font and Font Size Selection
- it is now possible to change the font you use and the font size
- Miscellaneous
- new toolbar buttons
- new menu options
- many shortcuts have been added to speed up working with NetAccess
- tooltips have been added to all buttons
- a new shortcut (Ctrl+Tab) to cycle thru all the NetAccess "tabs"
- a new C# Code button to return mode easily to the generated C# Code "tab"
- NetAccess ScreenCasts Tutorials
- Tutorial #1 shows how to create a C# DLL including a Person object, how to define several properties and a method, and how to work back and forth between NetAccess and Visual Studio 2005/2008: then the C# DLL is used from APL+Win
- Tutorial #2 shows how to exploit the Microsoft .Net Regular Expressions classes from APL+Win: the Tutorial starts by creating a C# DLL with a Replace method allowing you to replace strings in a given text according to Regular Expressions; it then shows how to use the DLL from APL+Win. Finally a more complex method is added to the DLL using NetAccess: the method code is written under Visual Studio and after the DLL is compiled, it is used again under APL+Win. This Tutorial also demonstrates how to write some simple Regular Expressions.
What was new in NetAccess 1.2
NetAccess has been improved and includes the following enhancements:
- now remembers the last directory used for loading or saving a NetAccess script file
- a toolbar has been added with buttons for most menu options
- a few improvements have been made in the way the C# DLL was built
Product content
NetAccess 2.2 includes the following:
- an APL+Win workspace with unlocked APL code containing the NetAccess C# Code Generator and various utilities
- a C# COM Interop DLL allowing you to use Regular Expressions from APL+Win
- several C# sample DLLs (complete C# Solutions with source code), among which:
- a DLL showing how to use the various C# types
- a DLL allowing to send Email asynchronously
- a DLL showing how to exploit the C# DateTime object
- a DLL showing how to use a C# visual control from APL+Win (MaskedTextBox)
- a 100 pages NetAccess Manual
The NetAccess C# Code Generator
Although the NetAccess documentation gives you all the information you might need to write and prepare C# DLLs yourself for use by APL+Win, NetAccess also includes a complete C# Code Generator which does almost all the work for you.
Not only does this mean much faster development, but also much simpler development and a way to avoid the various errors and typos which would result from manual development.
The C# Code Generator is invoked by loading the
NETACCESS.W3 delivered workspace and calling the
Generate function as follows:
Generate''
The following screen shot shows a sample C# Code Generator session where part of the C# generated code is visible.

You can now change the font and the font size as desired:

Using the C# Code Generator
Using the C# Code Generator is very simple:
- you type a NameSpace name (any character string using only letters will do)
- you type a class name (any character string using only letters will do)
- you decide if you want to create a C# DLL including a visual User Control or not by checking the User Control check box
- you click on Properties to define the properties you want your C# DLL to include (see below)
- you click on Methods to define the methods you want your C# DLL to include (see below)
- you click on Events to define the methods you want your C# DLL to include (see below)
- you finally click on the Generate button and the C# generated code (partly shown in the first screen shot above) gets displayed and is also automatically copied to the clipboard: all you need to do from there on, is to paste the generated code into your Visual Studio C# project and possibly complete some of your generated properties, methods, events with some additional C# code, if you need so.
- you can later on add, remove, rename properties, methods, events and arguments or change their types using the Properties, Methods and Events buttons: changes are immediately and automatically reflected in the C# code
Note that you can easily save your C# Generated Code projects using the File menu:
You can thus save a C# Generated Code project complete with its properties, methods, events definitions, C# generated code, namespace and class names and then reload it later on to complete it by adding more properties, methods, or events.
You can also start a new project by loading a previously saved project as a starting point for you new project, rename it and adapt it.
C# Generated Code projects have .CCG extension.
Using your C# DLL from APL+Win
Here is a sample APL+Win Session showing how to use the C# DLL generated in the above example:
'person'Œwi'Create' 'LescasseConsulting.NetAccess.Person'
ot
'person'Œwi'xName' 'Lescasse'
'person'Œwi'xBirthDate'(1951 3 5)
'person'Œwi'xName'
Lescasse
'person'Œwi'xBirthDate'
1951 3 5
Œdr'person'Œwi'xBirthDate'
323
'person'Œwi'onXComputedAge' 'Œ„"I have computed that ",(2œŒwarg)," is ",(•1œŒwarg)," years old!"'
'person'Œwi'XAge'
I have computed that Lescasse is 56 years old!
55
Œdr'person'Œwi'XAge'
I have computed that Lescasse is 56 years old!
323
In the above example, we start by creating an instance of the Objects.TestCodeGen C# object (available to APL+Win after the C# DLL has been successfully compiled): we then use the xName and xDateBirth properties defined in the C# DLL, define a handler for the onXComputedAge event defined in the C# DLL and call the XComputeAge method defined in the C# DLL. The C# code for the ComputeAge method is:
As you can see, this method fires the ComputedAge event on the 4th line, passing it 2 arguments (result and Name) and, as you can see, not only does the ComputedAge event fire in APL, but we do get the arguments passed by C#, through the regular
ŒWARG mechanism.
Here is another one showing an APL function which uses a C# DLL developed to allow sending Emails asynchronously:
’ TestMail2;R;Z;html;text;recipients
[1] ©’ R„TestMail2 -- Sample function sending many E-mails from APL+Win
[2] ©’ asynchronously using the OBJECTS.DLL C# 2.0 Assembly
[3] ©’ Note: before using Objects.Mail, you must register the
[4] ©’ OBJECTS.DLL C# 2.0 Assembly. To do so:
[5] ©’ 1. be sure to have installed Microsoft .Net Framework 2.0 on your computer
[6] ©’ 2. copy OBJECTS.DLL anywhere on your computer (say in C:\TEMP)
[7] ©’ 3. register it running the following command from the
[8] ©’ "c:\windows\microsoft.Net\framework\v2.0.50727" directory
[9] ©’
[10] ©’ regasm /tlb /codebase "c:\temp\objects.dll"
[11] ©’
[12] ©’ One needs to run this <regasm> command only once for a given computer.
[13] ©’ Requires: (F) AV2ANSI
[14] ©’ Copyright (c) 2006 Eric Lescasse
[15]
[16] html„'<HTML><BODY>'
[17] html„html,'<FONT SIZE="14"><B>'
[18] html„html,'This is my first test sending a mail from APL<br/>'
[19] html„html,'using a .Net C# Assembly'
[20] html„html,'</B></FONT>'
[21] html„html,'</BODY></HTML>'
[22]
[23] recipients„›'"Eric Lescasse" <eric@lescasse.com>' © for test purposes only
[24] recipients„recipients,›'recipient2@domain2.com'
[25] recipients„recipients,›'recipient3@domain3.com'
[26] recipients„recipients,›'recipient4@domain4.com'
[27] © etc. There maybe thousands of recipients: their E-mail
[28] © addresses would generally nbe retrieved from a database
[29]
[30] Z„'mail'Œwi'*Create' 'Objects.Mail'
[31] Z„'mail'Œwi'*xServer' 'smtp.easynet.fr'
[32] Z„'mail'Œwi'*xPort'25
[33] Z„'mail'Œwi'*xFrom' '"Eric Lescasse" <eric@lescasse.com>'
[34] Z„'mail'Œwi'*xReplyTo' 'info@lescasse.com'
[35] Z„'mail'Œwi'*xSubject'(AV2ANSI'Lescasse Consulting Newsletter')
[36] Z„'mail'Œwi'*xBodyHTML'(AV2ANSI html)
[37]
[38] :for I :in ¼½recipients
[39] Z„'mail'Œwi'*xTo'(Iœrecipients)
[40] © Z„'mail'Œwi'*xCC'(Iœrecipients)
[41] Z„'mail'Œwi'*xBCC' 'info@lescasse.com' © useful to get a copy of the mail
[42] Z„'mail'Œwi'*onXCompletedCallback' 'Œ„Œwarg'
[43] Z„'mail'Œwi'*xPriority' 'High' © or 'Low' or 'Normal'
[44]
[45] R„'mail'Œwi'*XSendAsync'
[46] :if R¬0
[47] Œ„'mail'Œwi'*xError'
[48] :endif
[49]
[50] :endfor
[51]
[52] Z„'mail'Œwi'*Close'
[53] Z„'mail'Œwi'*Delete'
[54]
’
This example shows the use of a more complete C# DLL containing a number of properties, methods and events. This DLL and its source code is delivered with NetAccess.
It helps send E-mailings from APL+Win to a large number of recipients in no time!
It is a good example of the use of C# to solve a problem that APL+Win could not solve easily or solve at all since APL+Win does not natively support threads.
Using C# visual objects from APL+Win
NetAccess even allows you to use C# visual objects from APL+Win.
For example, with NetAccess, you could easily generate the C# code for a DLL containing a MaskedTextBox user control and then use this DLL from APL+Win and populate some APL+Win forms with the MaskedTextBox control and use all of its .Net properties, methods, events.
This is particularly interesting since C# includes so many powerful visual objects which suddenly become available to APL+Win.
FAQ
Who can use NetAccess 2.2?
NetAccess can be very useful to any APL+Win developer. But the usefulness of NetAccess is not limited to APL+Win: NetAccess can be successfully used by users of such development systems as Visual Basic 6, and in general of any development system which can call ActiveX.
Do I need to own a copy of Visual Studio 2005/2008 to use NetAccess?
Yes. You will need to write some C# code and Visual Studio 2005 is the best development environment for C#.
Do I need to know C# to use NetAccess?
You don't need to know C# to create some C# DLLs repeating the documentation examples or to write simple C# DLLs of your own mimicing what's described in the documentation. The NetAccess documentation explains with a lot of details how to write a C# DLL, on a step by step basis. Moreover, the NetAccess C# Code Generator can do most of the job automatically for you, without errors. However the C# Code Generator can only write the C# Code skeleton, with all the required attributes and with your defined properties, methods and events. You will generally have to complete the generated code with some additional code for your C# methods and with your C# events argument definitions. The NetAccess documentation has been written for people having never used Visual Studio 2005 or C#: it is a good tutorial on how to start with C#. If you work in an environment where there are C# developers you may also hand up to them the NetAccess C# generated code and ask them to write the C# complement code for you.
How difficult is C# to master?
You may decide to become a C# expert and it will take a long time (just as long as it may take to become an APL expert), but frankly you will not need to become a C# expert to successfully use NetAccess. There are thousands and thousands of useful free C# classes to be found on Internet, which you are allowed to copy/paste: this will often be enough to solve your problem. You will definitetly need to learn the basics though.
Is the NetAccess generated code complete?
Yes, it is a complete skeleton of your C# class with:
- all the required interfaces set up for you
- all the required attributes set up for you
- all the desired properties, methods and events
- an additional method already setup to test your events
However it obviously does not contain your application proprietary code. For example, the ComputeAge method is generated by the C# Code Generator as:
and to make it do something interesting, you may want to change it to:
Does NetAccess really gives access to the full .Net Framework from APL+Win?
Yes.
I own an old version of APL+Win: can I use NetAccess?
Yes, as long as the APL+Win version you have can call ActiveX.
You may need to request to us a file version of the INTEROP.W3 workspace which you will be able to recreate using the FILETOWS utility found in the WFCARE.W3 workspace delivered with APL+Win (see the TOOLS subdirectory)
Is the C# DLLs I created usable (from APL+Win) on other computers than mine?
Yes. You need to do 2 things:
- copy the C# DLL on the other computer
- register the DLL with the following DOS Command:
regasm /tlb /codebase "c:\pathname\dllname.dll"
(the .Net 2.0 Framework, a free 21 MBytes download from Microsoft, must have been installed on the target computer and this command needs to be run in the c:\windows\microsoft.Net\framework\v2.0.50727 directory)
Do you provide Training classes or sessions?
Yes, 2 kinds of Traning:
- C# training to teach you the basics you need to know in order to get started developing your own C# DLLs
- training on how to most successfully use NetAccess with APL+Win
If you feel you need any of these, please contact me.
What is the cost of NetAccess?
500 USD (or 400 €)