Solved

Expected ;

Posted on 2006-07-19
5
223 Views
Last Modified: 2010-04-16
Why am I getting expected ; when I have one?

        try
        {
            objReader = New StreamReader("C:\\inetpub\\wwwroot\\search\\SearchRestults.aspx");
            strContents = objReader.ReadToEnd();
            objReader.Close();
            return new MyVirtualFile("Search/", strContents);
        }
...
0
Comment
Question by:dba123
  • 3
5 Comments
 
LVL 4

Expert Comment

by:DarkXiphoid
ID: 17137722
Hmm, the bit of code seems fine, no missing ;'s. Do you have a catch or finally?  you must always use either "catch" of "finally" after a try, else it won't compile.

0
 
LVL 1

Author Comment

by:dba123
ID: 17137867
yea, the ... means I have the rest there

    public override System.Web.Hosting.VirtualFile GetFile(string virtualPath)
    {
        String strContents;
        StreamReader objReader;  
        try
        {
            objReader = New StreamReader("C:\\inetpub\\wwwroot\\search\\SearchRestults.aspx");
            strContents = objReader.ReadToEnd();
            objReader.Close();
            return new MyVirtualFile("Search/", strContents);
        }
        catch (Exception Ex)
        {
            return Ex.Message;
        }
    }
0
 
LVL 1

Author Comment

by:dba123
ID: 17137915
well I don't think it recognizes the method StreamReader.  I get that little helper underscore thingy in VS 2005 asking me if I want to create a message stub for StreamReader.  Usually this means the complier doesn't recognize it.  I have using System.IO at the top so I don't know what the deal is.
0
 
LVL 6

Accepted Solution

by:
e1v earned 500 total points
ID: 17138209
It's because uou are using "New" with a capital N !

Use "new" instead
0
 
LVL 1

Author Comment

by:dba123
ID: 17138217
still getting used to C#, thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
c# if statement weird reaction 3 42
Why don't I see this table in EDMX file? 2 23
What .NET URL re-routing tool did I use? 2 36
Error on link 14 36
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now