Simplest program ever - and does not work!

  • Thread starter Thread starter Angel Salamanca
  • Start date Start date
A

Angel Salamanca

Hello all,

Just downloaded the .NET SDK and, to test it works, I
write this "Hello world" code:

Option explicit

Imports System

' A "Hello World!" program in Visual Basic.

Module Hello
Sub Main()
Microsoft.VisualBasic.Interaction.MsgBox("Hello, world!")
End Sub
End Module

It compiles fine and works. Now I replace the MsgBox
sentence with just

MsgBox("La vamos a liar")

and the compiler does not like it. It tells me 'Name
MsgBox is not declared'. So is not the import statement
working?

Given this symptom, what could be the problem?

Regards
 
Hello all,

Just downloaded the .NET SDK and, to test it works, I
write this "Hello world" code:

Option explicit

Imports System

' A "Hello World!" program in Visual Basic.

Module Hello
Sub Main()
Microsoft.VisualBasic.Interaction.MsgBox("Hello, world!")
End Sub
End Module

It compiles fine and works. Now I replace the MsgBox
sentence with just

MsgBox("La vamos a liar")

and the compiler does not like it. It tells me 'Name
MsgBox is not declared'. So is not the import statement
working?

Given this symptom, what could be the problem?

Regards

Add:

Imports Microsoft.VisualBasic
 
Hi Angel,

Most of the visitors here are using Visual.Studio Net,
I am not sure if you are using that.

But you can try
Option explicit

Imports System
Imports Microsoft.Visual.Interaction
Module Hello
Sub Main() MsgBox("La vamos a liar")
End Sub
End Module

Will maybe work, but I am not sure of that, because I never did compile
withouth Visual.Studio.Net (when you are using it, this will as far as I can
see now give no problem).

I hope this helpst,

Cor
 
Angel Salamanca said:
Hello all,

Just downloaded the .NET SDK and, to test it works, I
write this "Hello world" code:

Option explicit

Imports System

' A "Hello World!" program in Visual Basic.

Module Hello
Sub Main()
Microsoft.VisualBasic.Interaction.MsgBox("Hello, world!")
End Sub
End Module

It compiles fine and works. Now I replace the MsgBox
sentence with just

MsgBox("La vamos a liar")

and the compiler does not like it. It tells me 'Name
MsgBox is not declared'. So is not the import statement
working?

Given this symptom, what could be the problem?

You do not import Microsoft.VisualBasic.Interaction, you only import System.
Msgbox is not a member of Sytem.
 
* "Angel Salamanca said:
Just downloaded the .NET SDK and, to test it works, I
write this "Hello world" code:

Option explicit

Imports System

' A "Hello World!" program in Visual Basic.

Module Hello
Sub Main()
Microsoft.VisualBasic.Interaction.MsgBox("Hello, world!")
End Sub
End Module

It compiles fine and works. Now I replace the MsgBox
sentence with just

MsgBox("La vamos a liar")

and the compiler does not like it. It tells me 'Name
MsgBox is not declared'. So is not the import statement
working?

Alternatively you can specify the imports when calling "vbc.exe"
("/imports:..."). Just type "vbc.exe" and see its command line
parameters.
 
Back
Top