Sub Main Not Found

G

Guest

Okay...this is my last post for the week!! I've been follwoing the examples
in BOL/MSDN and yet I'm encountering issues constantly. This one is actually
occuring when I'm in VS and trying to create the actuall script. Here are the
steps I'm taking:

1. Create a new empty VB project called Project3
2. Add a web reference to the Reporting Services web service. This succeeds.
The reference appears in my solution explorer.
3. I ADD a new item - a VB codefile.
4. I add the following code to the code file:

Imports Project3.RSWebReference

Public Shared Sub Main()
Dim rs As New ReportingService2005()
Dim items() As CatalogItem
items = rs.ListChildren("/", True)

Dim item As CatalogItem
For Each item In items
Console.WriteLine(item.Name)
Next item

End Sub

5. Intellisense picks everything up. However, when I try to debug this code,
I get the following:

'Sub Main' was not found in 'Project3'

As you can see, Sub Main IS in the project. I have also verified that Sub
Main is chosen as the Start Up Object in Project Properties.

I seriously don't get it...what am I missing??
 
P

Patrice

Hi,

Not sure what you meant by a "code file". Is this is a class or a a module
file ? In both cases the sub should be inside a module or a class statement.

Does the reference to RS matter or do you have the same result with no
reference and an empty Main subroutine ?
 

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