473,883 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

correct overloaded version for Activator.Creat eInstance? I am getting "Constructo r on type xxx not found."

Is Activator.Creat eInstance(t,Bin dingFlags.Publi c | BindingFlags.In vokeMethod | BindingFlags.Cr eateInstance, null, args, null) appropriate given the following;

*************** *************** ********

public interface IPasswordProvid er
{
string GetPassword(Tok en token);
}

public DBPassword()
{
// constructor logic goes here
}

*************** *************** ********
public string GetPassword(Tok en token)
{
string sPassword;
sPassword = "password";
return sPassword;
}

*************** *************** ********

and what I have to include as an argument to pass to the GetPassword() is an instance of the following class;

public class Token
{
protected string m_strPWD;
public Token()
{
}
public string Password
{
get
{
return m_strPWD;
}

set
{
m_strPWD=value;
}
}

*************** *************** ********

for which I am attempting something like;

Token tkn = new Token();

tkn.Password = "password";

object[] args = {tkn };

but when I utilize this along with Activator.Creat eInstance(t,Bin dingFlags.Publi c | BindingFlags.In vokeMethod | BindingFlags.Cr eateInstance, null, args, null),

I get the following - {"Constructo r on type DBPasswordProvi der.IPasswordPr ovider not found." } System.Exceptio n

*************** *************** ********

Any help will be very much appreciated...

Thank you,

-Greg

Nov 16 '05 #1
3 5752
but when I utilize this along with Activator.Creat eInstance(t,Bin dingFlags.Publi c | BindingFlags.In vokeMethod | BindingFlags.Cr eateInstance, null, args, null),

I get the following - {"Constructo r on type DBPasswordProvi der.IPasswordPr ovider not found." } System.Exceptio n


Which type does the t variable represent here? If it's
typeof(IPasswor dProvider) then the error message makes sense, since
interfaces don't have constructors.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 16 '05 #2
Thank you Mattias! As a follow up to that is it necessary to take the
interface out of the assembly?
Appreciatively,
-Greg

"Mattias Sjögren" <ma************ ********@mvps.o rg> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
but when I utilize this along with Activator.Creat eInstance(t,Bin dingFlags.Publi c | BindingFlags.In vokeMethod |
BindingFlags.Cr eateInstance, null, args, null),
I get the following - {"Constructo r on type
DBPasswordProvi der.IPasswordPr ovider not found." } System.Exceptio n
Which type does the t variable represent here? If it's
typeof(IPasswor dProvider) then the error message makes sense, since
interfaces don't have constructors.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 16 '05 #3
I removed the interface from the assembly and the reference to the interface
and still get the same error.
I am thinking that this is a generic error message and that the real problem
is that one of the arguments I am passing is not correct. Like the args for
example. I am trying to pass in my token object and it may not like
that....
Thanks you for any comments or ideas.
-Greg

"Mattias Sjögren" <ma************ ********@mvps.o rg> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
but when I utilize this along with Activator.Creat eInstance(t,Bin dingFlags.Publi c | BindingFlags.In vokeMethod |
BindingFlags.Cr eateInstance, null, args, null),
I get the following - {"Constructo r on type
DBPasswordProvi der.IPasswordPr ovider not found." } System.Exceptio n
Which type does the t variable represent here? If it's
typeof(IPasswor dProvider) then the error message makes sense, since
interfaces don't have constructors.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
1694
by: Sean Hamilton | last post by:
Hello, Suppose I have a pointer to some structures. What would be the correct type to store the number of entries in that array, as well as for indexing that array? size_t seems like an obvious choice, but off_t also jumps to mind. Thanks, --
7
1822
by: WildHare | last post by:
If I have a class and I add it to an ArrayList and then want to access that class using using the index operator (e.g. ArrayList) the ArrayList returns a type "Object". I can cast the return to the correct type (my class) but that will lead to very convoluted calls to get embedded elements or to call methods. For example: I have a class called "Field"
1
2273
by: Soheil | last post by:
Hi, Why when System.Version type is serialized, none of its Major, Minor, etc properties are serialized? I get <MyVersion /> when i serialize an instance of System.Version using XmlSerializer! Thanks in advance
3
1513
by: Mark Ingram | last post by:
Hi, if in a file i have the following: <variable type="String">Hello World</variable> <variable type="Int32">29</variable> How can i create these variables in my application? (Ignore the reading of the text in, that part is easy). I guess it would be easy enough by doing a giant "if" statement, but thats a horrible solution.
1
1341
Yanskopolis
by: Yanskopolis | last post by:
What's the correct "type" attribute to use with the script tag? I've seen examples that use this: <script type="text/javascript"> .... </script> and examples that use this: <script type="application/x-javascript"> ...
0
948
by: afterwave | last post by:
I have written a component called PlotPanel which inherits from System.Windows.Forms.Panel. When the control is used in the design window the default constructor "this.plotPanelReal = new PlotPanel();" is generated in "Windows Form Designer generated code". I want to use an overloaded constructor instead: "this.plotPanelReal = new SEA.PlotPanel(nbXMin, nbXMax, nbYMin, nbYMax);" (nbXXXX is number boxes which inherits from TextBox). If I just...
1
1276
by: bob | last post by:
I was just wondering if overloaded type cast functions must always be member functions of some class.
1
1184
by: cmdolcet69 | last post by:
How can i cast down a word16 (4 bytes) rather than just a byte. You need to cast it to the correct type.
1
3018
by: mersinli | last post by:
Hi, I have got seven error and I dont find why compiler find error.. //commission class definition #ifndef COMMISSION_H #define COMMISSION_H #include <string> using std::string;
0
9942
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11142
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10416
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7129
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5797
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5991
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4220
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.