?
Solved

Need help with the an error in my development

Posted on 2014-08-28
9
Medium Priority
?
314 Views
Last Modified: 2014-08-29
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.IDropdownLists 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.

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;
        }

Open in new window

0
Comment
Question by:Sherry
  • 4
  • 2
  • 2
8 Comments
 
LVL 13

Accepted Solution

by:
Chris Raisin earned 2000 total points
ID: 40291994
Have you actually defined a member of the class BusinessLogicLayer.IDropdownLists anywhere in your code (code external to the class code you have shown)?

Perhaps the compiler is getting confused between a call to the System dropdownlist and a call to "A" so you need "a" to be be defined somewhere in your code.

I suspect the error is not actaully happening in the code you supplied, but rather in a process using an instance that is supposed to be of type BusinessLogicLayer.iDropdownlist but is not actaully defined in your code
(I hope this makes sense).

Can you not state WHERE the error is happening (or is it preventing a compile and appears before the run?)
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40292722
Agree with the above:  It helps us to know which line throws the error.

Side comment:

A - is the BusinessLogicLayer.IDropdownLists class
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).
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 40292829
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.IDropdownLists" 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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40292877
@craisin

I was referring to:

...IDropdownLists class

= )
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 40292931
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)
0
 

Author Closing Comment

by:Sherry
ID: 40293102
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.
0
 
LVL 13

Expert Comment

by:Chris Raisin
ID: 40293719
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)
0
 

Author Comment

by:Sherry
ID: 40293753
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.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Make the most of your online learning experience.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
Starting up a Project

864 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