472,364 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 software developers and data experts.

Question on BindingSource and Explicit Interface Properties

In an application I have an interface with methods and properties. The
interface is used on a Class (ie class MyClass : IMyClassA, IMyClassB). On a
windows form I define a BindingSource (_bindingMyClass) where I set the
DataSource property to the interface IMyClass.

Now when the MyClass object is instantiated I set the BindingSource to the
instance of the IMyClass interface (_MyClass)

_bindingMyClass.DataSource = this._MyClass;

If the implement of the MYClass class uses expliciit interface
specifications for the properties, I get and ArgumentException on the above
code setting the DataSource.

If the implementation of the MYClass IMyClass interface specification are
not explicit, the above line works.

My question is why? I thought the only difference between an explicit
interface and an "standard" interface is to allow a class to have more than
one interface specified and have each interface implementation be unique.

Thanks,

Dec 6 '07 #1
1 3121
JM,

I'm not surprized. The binding is looking at the publically accessible
members on the implementation type, not the interfaces that it implements.
The reason it works when you use implicit interface implementation is
because you have to declare those members as public for the implementation
to be performed.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"JM" <JM@discussions.microsoft.comwrote in message
news:6E**********************************@microsof t.com...
In an application I have an interface with methods and properties. The
interface is used on a Class (ie class MyClass : IMyClassA, IMyClassB).
On a
windows form I define a BindingSource (_bindingMyClass) where I set the
DataSource property to the interface IMyClass.

Now when the MyClass object is instantiated I set the BindingSource to the
instance of the IMyClass interface (_MyClass)

_bindingMyClass.DataSource = this._MyClass;

If the implement of the MYClass class uses expliciit interface
specifications for the properties, I get and ArgumentException on the
above
code setting the DataSource.

If the implementation of the MYClass IMyClass interface specification are
not explicit, the above line works.

My question is why? I thought the only difference between an explicit
interface and an "standard" interface is to allow a class to have more
than
one interface specified and have each interface implementation be unique.

Thanks,
Dec 7 '07 #2

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

Similar topics

5
by: george r smith | last post by:
I thought that you it is forbidden to create an instance of an interface. But a help example (search for Explicit Interface Implementation Sample) from visual studio has the following sample...
13
by: Michael.Suarez | last post by:
Let's suppose I have an instance of MyClass, which has the properties MyText1 and MyText2, and sets the values of MyText1 and MyText2 to 'A' and 'B' in it's constructor. Let's also suppose I...
1
by: TN | last post by:
I just don't get the BindingSource class when it is bound to a class. Consider this code snip: ..... Private bSource As New BindingSource() Private dgv As New DataGridView() Public Sub New()...
2
by: Steve | last post by:
Hi- OK, I've got a DataGridView, I've created a BindingSource from one of my Business Entity object (based on generated classes from EntitySpaces) I've left the default column setup so that all...
9
by: davetelling | last post by:
I am not a programmer, I'm an engineer trying to make an interface to a product I'm designing. I have used C# to make a form that interrogates the unit via the serial port and receives the data. I...
14
by: Noone | last post by:
Hello all, Ok, I want to create a program that will load plugins (dll's) from a plugin folder. I can create the forms and put them into a dll but I cannot actually add them dynamically at run...
3
by: Przemek M. Zawada | last post by:
Dear Group, I'm developing sample window form, using DataGridView control, which is filled with data through BindingSource, which is based on type of object, as follow: public sampleClass {...
1
by: Frank Rizzo | last post by:
Hello, I've taken over a .net 2.0 project that makes heavy use of Data Binding of business classes to 3rd party WinForm controls via the BindingSource class and INotifyPropertyChanged interface. ...
2
by: jehugaleahsa | last post by:
Hello: I'm working on improving some of our Windows Forms. I have created two user controls that I want to bind to the same BindingSource. I have an overview control that is used just to...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.