Solved

Expected ;

Posted on 2006-07-19
5
222 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

19 Experts available now in Live!

Get 1:1 Help Now