Simplest program ever - and does not work!

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
 
T

Tom Shelton

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
 
A

Angel Salamanca

Problem solved, many thanks to both responders.
-----Original Message-----
Type
Imports Microsoft.visualbasic.interaction

at the top of ur program.





.
 
C

Cor

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
 
A

Armin Zingler

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.
 
H

Herfried K. Wagner [MVP]

* "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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top