473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 3188
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.