Silverfrost Forums

Welcome to our forums

.NET VB Calculator Example in VS2005

2 May 2008 1:00 #3132

I've installed the personal edition (ftn95_personal.exe) on an XP system with VS2005 Standard Edition. When I try to use the VB Calculator example by clicking on

...\FTN95Examples\NET\FortranCalculator\VB\VB_Calculator.sln.

VS2005 attempts to convert this, but the conversion doesn't work ('One or more projects failed to convert...'). The FortranCalculatorFrontend is noted in the SolutionExplorer as 'unavailable'. I've tried adding the vb code manually and have un-installed and re-installed two times to no avail. I have also tried to build the program manually per the help instructions:

ms-help://MS.VSCC.v80/MS.VSIPCC.v80/Silverfrost.FTN95Help/FTN95Help/HTML/NETSAMPLES/FORTRANCALCULATOR.HTM

but (after fixing a couple of name-changes (see *1 below)) the program still will not run. When I compile the 'Debug' version I get the error: 'Unable to start debugging for target: ...Calculator.dll'. When I compile and run the release version, I get the standard Windows error: '...has encountered a problem and needs to close...'

*1 The 'ContainingClass' noted in the help file for the VB Calculator example is different from the 'ContainngClass' used in the example that was installed with the compiler. The difference is 'FTN95Calculator' versus 'ftncalc'. Also the Assembly_Interface for the PI function was different: 'PiValue' versus 'PiVal'.

On a very basic level, I noticed that the file dates/times in the example folder are significantly different. For example, some dates are:

10/21/2002 12:31 PM 1,028 AssemblyInfo.vb 07/03/2003 03:21 PM 3,566 VB_Calculator.sln 07/03/2003 03:21 PM 4,619 FortranCalculatorFrontend.vbproj 02/22/2008 10:48 AM 1,391 calculator.f95

Lastly, the other examples work (although with some I have to tinker a little after the conversion is made).

So, my question for the forum users is: Has anyone recently:

  1. Downloaded and installed the personal edition (ftn95_personal.exe);
  2. Double-clicked on the calculator example solution (...\FTN95Examples\NET\FortranCalculator\VB\VB_Calculator.sln);
  3. Had VS2005 successfully convert the solution;
  4. Built and run the program simply by doing a 'Build' - 'Build Solution' and 'Debug' - 'Start Debugging'.

If you have done this (without any other steps), then I at least know I have to fix something on my install of FTN95 or VS2005.

Any suggestions?

One other thing, I have successfully built the program by running the batch file buildrel.bat (after I added the necessary paths to vbc and resgen), but this does not create a solution I can load/view/edit in VS2005.

Thank you, matt

3 May 2008 7:11 #3142

There does seem to be a problem with the VB example for Fortran Calculator when using it direct from the examples.

The code differences in the help file are to do with small differences between the C# example and the VB .NET example.

We will have to recreate the example for the next release (this will not be done for the up-coming 5.21), but in the short term - you say the solution builds OK from the batch files - so there is nothing wrong with the code as such. You could recreate the projects from the code contained in the source files if you really need to see this example as you say you have tried. The error you are getting on running the code in debug suggests to me that you have not got the correct project set as the startup project - make sure the frontend is set as the startup project.

5 May 2008 4:30 #3152

Andrew, Thank you for confirming that there is a problem with the example. I decided to give the manual approach (building the solution using just the calculator.f95 and fortrancalculatorfrontend.vb) one more shot, so I un-installed and re-installed, and then tried it, making sure to have the VB_Calculator as the 'Single startup project'. I had to make a couple changes:

  1. Per the 'Option Explicit' setting, I made the character type literals explicit (e.g., changed add_digit('0') to add_digit('0'c)). I know I could have turned the 'Option Explicit' off, but I just made the change so it would work with it on.

  2. Commented out the line (from InitializeComponent)

Me.Icon = CType(resources.GetObject('$this.Icon'), System.Drawing.Icon)

because it was causing the program to crash during Debugging.

So, it works now and is useful to me as I try to evaluate FTN95. My question now is the following: I am currently evaluating FTN95 versus compilers from Lahey and Intel. There are plusses and minuses I see with each of these. The main ones (for our company) being:

Lahey (+ we have been using Lahey for 10+ years; - no integration with .NET Framework 2.0 or beyond) Intel (+ stability, robust development and support; - no integration with .NET) Silverfrost (+ integration with current .NET (3.5)).

The negative with Silverfrost for me is the subject of this post: Why don't all the examples work, and why couldn't someone have sent me an updated calculator example that did work?

Any response you can give will be helpful.

Thank you, matt

6 May 2008 8:03 #3157

Some of the samples were created for ealier versions of Visual Studio and Microsofts solution upgrade process does not always work. This means that separate samples are required for each version of Visual Studio.

The problems lie in the project settings and, with a little effort, it is possible to reinstate the correct starting project and project dependencies etc. These are things that you will have to do when creating your own projects so the learning process is not wasted.

We will do what we can to supply complete and working samples but the bottom line is, if you can get a better deal from a rival compiler then go for it.

6 May 2008 8:27 #3158

Just to reiterate what Paul Has said really - the example code was based around Visual Studio .NET 2003 (we provide integration for all versions of Visual Studio from 2003 upwards) and it is the Visual Studio upgrade tool that seems to be broken. The example for the VB calculator was broken, and now we have a bug report, a fixed example will be included in the next release.

Please login to reply.