Sherry
asked on
Need help with the an error in my development
Error code: 'A' does not contain a definition for 'B' and no extention method 'B' accepting a first argument of type 'A' could be found ( are you missing a using directive or an assembly reference?)
A - is the BusinessLogicLayer.IDropdo wnLists class
B - is the name of the dropdown list I'm adding to the application DropDownList_Instructors
Below is the code that applies to this issue.
A - is the BusinessLogicLayer.IDropdo
B - is the name of the dropdown list I'm adding to the application DropDownList_Instructors
Below is the code that applies to this issue.
BusinessLogicLayer.IDropDownLists
Using System.Collections.Generic;
Public interface IDropDownLists
{ IDictionary<string, string> DropDownList_SearchOptions { get;}
IDictionary<string, string> DropDownList_DateControl { get;}
IDictionary<string, string> DropDownList_STGSet( int GroupID );
IDictionary<string, string> DropDownList_UnitByFacility( int FacilityID );
IDictionary<string, string> DropDownList_Location_Administration { get;}
IDictionary<string, string> DropDownList_Reason_Administration { get;}
IDictionary<string, string> DropDownList_Instructors { get; }
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using BusinessLogicLayer;
namespace UIProcessLayer
{
public class Administration
{
static private IAdministration Administration1
{
get{ return BusinessLogicLayer.Administration.Create(); }
}
#region Administration : Dropdownlists
UIProcessLayer.Administration
{ ……..
public static IDictionary<string, string> DropDownList_SecurityGroup()
{
return Administration1.dropDownLists.DropDownList_SecurityGroup;
}
public static IDictionary<string, string> DropDownList_Grant_Security_Level_Screen_
SecurityGroup(int FacilityID)
{
return Administration1.dropDownLists.DropDownList_Grant_Security_
Level_Screen_SecurityGroup( FacilityID );
}
public static IDictionary<string, string> DropDownList_Facility_Search()
{
return Administration1.dropDownLists.DropDownList_Facility_Search;
}
public static IDictionary<string, string> DropDownList_Reason_Administration()
{
return Administration1.dropDownLists.DropDownList_Reason_Administration;
}
public static IDictionary<string, string> DropDownList_Location_Administration()
{
return Administration1.dropDownLists.DropDownList_Location_Administration;
}
public static IDictionary<string, string> DropDownList_Instructors()
{
return Administration1.dropDownLists.DropDownList_Instructors;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No, I think the author is just using "A" and "B" to save having to type the complete error message (which would have been very long). I gather he is substituting A & B into the error message typed out.
The author also appear to be correctly using the Interface "I" starting letter since I gather the code is for Interface, not class.
I am actually a VB.Net programmer, but all is very similar.
I'd guess maybe the error does not throw on a line, but is rather an error prior to a build/execute since the compiler cannot find a referenceto what the author has designated "A" in the error message, namely the
"BusinessLogicLayer.IDropd ownLists" and so it cannot find a variable that has been defined to that class. (All very confusing!)
Maybe he can make sense of this....This error message normally means there is basically a missing reference, either in the code (as in this case) or via the
Project Explorer "References" interface.
The author also appear to be correctly using the Interface "I" starting letter since I gather the code is for Interface, not class.
I am actually a VB.Net programmer, but all is very similar.
I'd guess maybe the error does not throw on a line, but is rather an error prior to a build/execute since the compiler cannot find a referenceto what the author has designated "A" in the error message, namely the
"BusinessLogicLayer.IDropd
Maybe he can make sense of this....This error message normally means there is basically a missing reference, either in the code (as in this case) or via the
Project Explorer "References" interface.
@craisin
I was referring to:
= )
I was referring to:
...IDropdownLists class
= )
Yes, that is correct.
The compiler is saying that nothing has been defined as being a member of that class.
It can find no refence to an instance of that class, so you need to instantiate an instance variable of that
class, such as: IDrop IDrop1 = new IDropdowlist();
(I am not a C# programmer so I am just guessing the format of this declaration.
In VB.Net is would be : Dim IDrop1 as IDropDowList
Either taht,or (as it says) "are you missing a using directive or an assembly reference?"
Should you have some missing "Using" statemant at the top of your code (either in the class code or external to it).
This error seems to commonly occur also when you have an identifier with the same name as something in a "Using" library (e.g. if you named a variable "Form" you would get this error, since the program would not know if you meant System.IO.Form or the variable named "Form".
Do a Google search on your error message (use the exact wording, the search will find all those similar to it) and there are hundreds of hits. Maybe one of those may help you out (particularly once involving C#)
Cheers
Chris (Melbourne)
The compiler is saying that nothing has been defined as being a member of that class.
It can find no refence to an instance of that class, so you need to instantiate an instance variable of that
class, such as: IDrop IDrop1 = new IDropdowlist();
(I am not a C# programmer so I am just guessing the format of this declaration.
In VB.Net is would be : Dim IDrop1 as IDropDowList
Either taht,or (as it says) "are you missing a using directive or an assembly reference?"
Should you have some missing "Using" statemant at the top of your code (either in the class code or external to it).
This error seems to commonly occur also when you have an identifier with the same name as something in a "Using" library (e.g. if you named a variable "Form" you would get this error, since the program would not know if you meant System.IO.Form or the variable named "Form".
Do a Google search on your error message (use the exact wording, the search will find all those similar to it) and there are hundreds of hits. Maybe one of those may help you out (particularly once involving C#)
Cheers
Chris (Melbourne)
ASKER
You were right. This is my first time adding something to an application. I'm new to programming in fact. There was another place I missed adding another line of code. I was adding an Instructor dropdown list as a parameter for one of the repors that we run from the application. It passes the parameter to reporting services for the report. Thank you.
My pleasure.
For the sake of clarity for others reading this solution, , could you please state the line of code which you added which fixed the problem, or state the "Using" line you added which satisfied the assembly reference?
Many thanks
Chris (Melbourne)
For the sake of clarity for others reading this solution, , could you please state the line of code which you added which fixed the problem, or state the "Using" line you added which satisfied the assembly reference?
Many thanks
Chris (Melbourne)
ASKER
Will do, I'll have to go back through it. But I will as soon as I can and will remember to in the future. Thanks.
Side comment:
I'm hoping this was just a misuse of terminology. The convention in .NET is to define interfaces with names that begin with a capital "i" (e.g. IEnumerable, IList, IDataReader, etc.). Classes should not start with an "i" unless it is a word (e.g. Invention, IceCube, Igloo).