Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Dec 2002
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CLR error (VB.NET/1.1)

    I have just started reading "Programming Microsoft Visual Basic.NET Version 2003" by Francesco Balena. In the Introduction, the author shows how to create a simple program using Notepad and compile it with vbc.exe. But it ends up with the error message:

    CLR error:80004005

    This is a bit discouraging start. Does anyone know what is wrong? I will list the whole program below:

    Module Module1
    Sub Main()
    Dim X As Double, Dim res As Double
    X = 12.5
    res = Add(X, 46.5)
    System.Console.Write("The result is ")
    System.Console.WriteLine(res)
    End Sub

    Function Add(ByVal n1 As Double, ByVal n2 As Double) As Double
    Add = n1 + n2
    End Function

    End Module

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CLR error (VB.NET/1.1)

    I doubt this is causing the error, but with .NET you should use Return in a function rather than setting the value to the function name.

    In your Add function, replace Add = n1+n2 with Return n1+n2

    How are you compiling? What command switches are you using? Do you have Visual Studio? If so, I would highly recommend doing everything with the interface rather than VBC.EXE.

  3. #3
    Lounger
    Join Date
    Dec 2002
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CLR error (VB.NET/1.1)

    Thank, Mark.

    I tried what you suggested, but no difference.

    I used, as the author suggested, the compiler from a command window:

    c:windowsMicrosoft.NETFrameworkv1.1.4322vbc Test.vb

    Test.bv is a file with the code.

    Yes, I have VS.NET, but creating an executable .NET file without using the IDE is the point of the exercise.

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CLR error (VB.NET/1.1)

    You might check into adding a few arguments to the compile command, particularly those referencing the needed System DLLs.

    You can view Microsoft's Simple Compilation Command Lines for more information.

    Hope this helps...

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: CLR error (VB.NET/1.1)

    I just threw the code in a VB .NET Form.
    Code worked.

    I have the Balena book.
    Page reference?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •