Using VB Converter




During installation, VB Converter will be installed as an Add-In to Visual Basic 5 or 6. When running VB the VB Converter toolbar is displayed which give you access to its functionality within the VB environment. VB Converter can also be run from the command-line for converting VB 3 and VB 4 projects or for adding to a DOS command script. The command-line syntax is:

<install dir>\vbc Project1.vpb
<install dir>\vbc Project1.mak

There is more discussion of the command-line version in the readme file, <install dir>\vbcReadme.txt. Also, if you run the command-line version without arguments it will give you usage information.

VB Converter Add-In Toolbar Buttons

The VB Converter toolbar comes equipped with 5 buttons.

Figure 3: VB Converter Toolbar

Make Button
The first button performs the actual conversion from Visual Basic code to Java which can be run as a Java Applet or a Java Application. During the compilation, a report window displays the progress and the final status of the conversion process including the number of files successfully compiled. The report window also displays any syntax errors which occurred during generation and compilation to Java class files.

Run Button
The second button uses the Java Virtual Machine (JVM) to run the compiled Java application.

Options Button
Refer to the VB Converter Options dialog section.

VB Source Anlayzer Button
Prints out some statistics on the current project. It calculates how many licenses are needed to convert the current project.

Help Button
The on-line help system is a useful tool which provides instant access to information designed to assist you in the use of VB Converter. It also contains all of the supported Visual Basic features.

VB Converter Options

The VB Converter Options dialog contains the following tabs:



Environment Tab

The Environment Tab has input controls to specify where tools are found and what options they need.







Figure 4: Environment Tab

Java Look and Feel. Java 2 can emulate the look and feel of multiple environments. Use this to designate what type of system the application should look and behave like. The system look and feel will make the application look like a native application on which ever platform it is executed on.

Java IDE. If you will be doing further development in an IDE such as Visual Cafe or JBuilder you will want to set it to appropriate IDE. Some of the IDE's such as Visual Cafe need to special tags generated in order to get maximum use of that environment. Note: The visual screen builders have been enabled for only JBuilder, JDeveloper, and Visual Cafe. All other IDE will only be able to use their text editors to edit the Form code.

Output Directory. Specifies a location for the Applet/Application files generated from a Visual Basic Project. Select the "Use Output Directory" if you want the file to be generated into this directory. Otherwise, they will be generated in the same directory as the VB source files.

Java Runtime Exe. To specify the Java runtime executable click on the browse (...) button. This executable is used to run the generated java application. This is typically named java.exe and is usually located in the bin directory underneath the directory that the Java SDK was intalled in.

Java Compiler. The Java Compiler is set by default to the Java Compiler included with the Java Development Kit. To specify a different compiler such as Microsoft Visual J++, click the browse button and select the required compiler.

User Name / Serial Number. Type in demo/demo or the user name and serial number exactly as it was given to you when you purchased the product.



Database Tab

Refer to the Java Database Connectivity Guide for detailed information about the Database Tab.

General Tab

In the General Tab you specify options related to code generation.

Figure 6: General Tab

Coding Style. CodingStyle controls the output style such as where {'s are placed. The JavaSoft style causes the { to appear on the same line as the keyword that starts the block. The Default style make the { begin on a new line just under the keyword that starts the block The two styles are illustrated below:

if (s.length() > 0) { // JavaSoft style
if( s.length() > 0 ) // Default style

Spaces per Indent. The number of spaces that each block should be indented can also be specified.

Compile Java Code. Causes the tool to invoke the Java compiler listed in the Environment tab after the Java code is generated.

Use Portable Fonts. If selected then all font names will be converted into one of the standard Java fonts: Serif, SansSerif, or Monospaced. These 3 fonts will use the appropriate font on each platform that the application. Otherwise, the Windows font name will remain.

Use jar library in HTML. If selected then the HTML file that is generated will reference the appropriate jar files. If not selected then the individual files will come from the diamondedge\* directories in the same place as the HTML file. You will need to copy them there if this is not selected.

Ignore On Error Resume Next. If selected all "On Error Resume Next" statements will be commented out. If not selected then a try/catch block will be generated around each line of code which simulates the VB behavior.

Java GUI Controls. This is used to specify which set of Java controls to use. All VB Converter extended controls inherit most of their behavior from the builtin Java controls such as the Java 2 Swing controls. For most applications it is recommended to use the Java 2 Swing (extended) controls option. By selecting this option you will have many more controls that can be converted to Java and you will have many more properties that are supported. The Swing (builtin) option uses the basic Java 2 swing controls directly instead of the extended controls. This option will cause more work to be done after conversion since there aren't as many properties and methods supported such as the ItemData property of a ListBox. When there are not equivalent controls available then the converter will use the swing extended controls. The 3rd swing option, Swing (Java 2 Only) is similar to the swing (builtin) option except that it will not use any extended controls. They become unsupported controls and their usages will be commented out. Each of these options require that you have a Java 2 compliant browser or Java runtime environment.

If you want very small applets that have almost fewer classes to download you should choose the AWT controls. They do not use very many of VB Converter extension Java classes so the download can be faster. These applets will work with any Java 1.1 compliant browser. There are very few controls that are supported and very few properties are supported on the AWT controls. This is only appropriate for small simple applications which is typically what you would have on a public internet. More complex application that are used on a company intranet should use one of the swing options above.

The Diamond Control Suite adds several additional controls that will be converted automatically. They will require the purchase of a license to that suite for each developer. See the supported features page for the list of controls supported by this suite.

VB API. The VB Compatible option generates code that uses our library when the corresponding Java API behaves differently than in VB or does not exist. The Use Java builtin option will generate code to the closest Java API. This option will require more work after the conversion in order to deal with the differences in behavior of the VB and Java versions of the API.

About Tab

The About Tab provides version information and contact information for customer support.