This project has moved. For the latest updates, please go here.

Visual Basic 2010 express

Apr 23, 2013 at 10:34 PM
Hello,

i have been trying to use your code to VB 2010 express and it does not work. is it compatible with this version of VB?

this is the code i used:

Imports System
Imports System.Collections.Generic
Imports Meta.Numerics
Imports Meta.Numerics.Matrices
Dim A As New SquareMatrix(3)
A(0, 0) = 1
A(0, 1) = 1
A(0, 2) = -1
A(1, 0) = 2
A(1, 1) = -1
A(1, 2) = 0
A(2, 0) = 0
A(2, 1) = -1

A(2, 2) = 1

Any help would be appreciated!! :)
Coordinator
Apr 24, 2013 at 7:24 AM
We haven't had any problems using Meta.Numerics with the VS2010 express editions. What error do you see when you compile or run this code?
Apr 24, 2013 at 8:09 AM
ty for you fast reply!


the error is: "Declaration expected."

it is located to the lines:

A(0, 0) = 1
A(0, 1) = 1
A(0, 2) = -1
A(1, 0) = 2
A(1, 1) = -1
A(1, 2) = 0
A(2, 0) = 0
A(2, 1) = -1
A(2,2) = 1
Coordinator
Apr 24, 2013 at 6:49 PM
From your description of the error, it sounds like your file contains exactly the lines of code you quoted and no others. VB.NET requires that all code be within methods, and all methods be within classes. For example, to embed your code within a console application that finds and prints the determinant of this matrix, the code would be:
Imports Meta.Numerics
Imports Meta.Numerics.Matrices


Module Module1

    Sub Main()

        Dim A As New SquareMatrix(3)
        A(0, 0) = 1
        A(0, 1) = 1
        A(0, 2) = -1
        A(1, 0) = 2
        A(1, 1) = -1
        A(1, 2) = 0
        A(2, 0) = 0
        A(2, 1) = -1
        A(2, 2) = 1
        Dim LU = A.LUDecomposition()

        Console.WriteLine(LU.Determinant)
        Console.ReadLine()

    End Sub

End Module
To review the steps: (1) In VS, select File > New > Project. Choose, for example, a Visual Basic Console Application. VS will scope out a basic framework for you code:
Module Module1

    Sub Main()

    End Sub

End Module
(2) Before filling in the code above, you need to add a reference to the Meta.Numerics library. Right click on your project in the solution tree, and choose Add Reference. In the dialog that pops up, navigate to and choose the Meta.Numerics library.

(3) Fill in the code above and press F5 to compile and run.

I apologize if I have misdiagnosed the problem or your level of familiarity with VB.NET. Please feel free to follow up with additional questions.
Apr 24, 2013 at 7:57 PM
I am quite new to Visual basic! I was using VB, 11 years ago, and it is quite different :d
so you didn't misunderstand anything! :)

I was using a Private Sub inside a button to a form , and it is very probable i didnt put an end sub maybe?

you example works perfectly! thank you very much for your reply and your interest to my problem :)