Reputation: 48015
I have, in the same folder, the class Home
and NewsRSS
.
Now, on Home's PageLoad
method I try to do this :
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
public partial class context_master_MenuPrincipale : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
NewsRSS myRss = new NewsRSS();
}
}
this is NewsRSS :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using Chilkat;
public partial class context_NewsRSS : System.Web.UI.UserControl
{
protected string m_strRSS = "";
protected void Page_Load(object sender, EventArgs e)
{
BuildRss();
}
private void BuildRss()
{
}
}
I get this error : The type or statement could not be found
Why? How can I fix this?
Upvotes: 0
Views: 116
Reputation: 14784
With the additional information:
Your class is named context_NewsRSS
and you refer to NewsRSS
. This will not work. Do it this way:
protected void Page_Load(object sender, EventArgs e)
{
context_NewsRSS myRss = new context_NewsRSS();
}
Although your question does not provide lots of information, these are the problems I can imagine:
NewsRSS
is declared abstract
, which means you cannot create an instance of it directly.NewsRSS
is declared internal
in another assembly, which means you cannot use it anywhere but in the declaring assembly or assemblies that can see the internal types of the declaring assembly (controlled by InternalsVisibleToAttribute
in the declaring assembly).NewsRSS
is declared in another namespace that is not referenced via the using
keyword in the file your code is located in.Upvotes: 0
Reputation: 32448
Your class is called context_NewsRSS
, but you're trying to refer to it as NewsRSS
.
You might be confusing classes and file names or page names, since you say you have a class Home
, when it's actually context_master_MenuPrincipale
Upvotes: 4