?
Solved

Expected ;

Posted on 2006-07-19
5
Medium Priority
?
240 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

777 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