473,544 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AmbiguousMatchE xception when getting property of a contro through reflectionl...

Hello,

The Type.GetPropert y() method is throwning "AmbiguousMatch Exception"
when getting value of control class through reflection.
The exception occurs under the following cases.
1. The class is derived from other class
2. Any of the parent class property is either overridden or shadowed in the
derived class
3. and trying to get the property value through reflection of the derived
class.

Which set of BindingFlags should be used in this case ?
Any help on this, is greatly appreciated
Regards,
....Ashok
------------------------------------------------------------------------
"It is beautiful for an engineer to shape and design the same way
that an artist shapes and designs. But whether the whole process
makes any sense, whether men become happier - that I can no
longer decide." - Rudolph Diesel
Nov 23 '05 #1
3 3380
Try with BindingFlags.De claredOnly (IIRC) to get only members declared in
the derived class, not in the base(s) class(es).

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"G.Ashok" <gw******@hotma il.com> escribió en el mensaje
news:u3******** ******@TK2MSFTN GP15.phx.gbl...
Hello,

The Type.GetPropert y() method is throwning "AmbiguousMatch Exception"
when getting value of control class through reflection.
The exception occurs under the following cases.
1. The class is derived from other class
2. Any of the parent class property is either overridden or shadowed in
the
derived class
3. and trying to get the property value through reflection of the derived
class.

Which set of BindingFlags should be used in this case ?
Any help on this, is greatly appreciated
Regards,
...Ashok
------------------------------------------------------------------------
"It is beautiful for an engineer to shape and design the same way
that an artist shapes and designs. But whether the whole process
makes any sense, whether men become happier - that I can no
longer decide." - Rudolph Diesel

Nov 23 '05 #2

Dear Carlos,

Thanks for the suggetion. I already tried it. infact almost every possble
combinations of the BindingFlags but failed to get it. Is there any bug in
CLR etc.?
Regards,
....Ashok
------------------------------------------------------
Make it real or else forget about it -- Carlos Santana

"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAM sogecable.com> wrote in message
news:ea******** *****@TK2MSFTNG P12.phx.gbl...
| Try with BindingFlags.De claredOnly (IIRC) to get only members declared in
| the derived class, not in the base(s) class(es).
|
| --
|
| Best regards,
|
| Carlos J. Quintero
|
| MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
| You can code, design and document much faster.
| Free resources for add-in developers:
| http://www.mztools.com
|
| "G.Ashok" <gw******@hotma il.com> escribió en el mensaje
| news:u3******** ******@TK2MSFTN GP15.phx.gbl...
| > Hello,
| >
| > The Type.GetPropert y() method is throwning "AmbiguousMatch Exception"
| > when getting value of control class through reflection.
| >
| >
| > The exception occurs under the following cases.
| >
| >
| > 1. The class is derived from other class
| > 2. Any of the parent class property is either overridden or shadowed in
| > the
| > derived class
| > 3. and trying to get the property value through reflection of the
derived
| > class.
| >
| >
| >
| > Which set of BindingFlags should be used in this case ?
| >
| >
| > Any help on this, is greatly appreciated
| >
| >
| > Regards,
| > ...Ashok
| > ------------------------------------------------------------------------
| > "It is beautiful for an engineer to shape and design the same way
| > that an artist shapes and designs. But whether the whole process
| > makes any sense, whether men become happier - that I can no
| > longer decide." - Rudolph Diesel
| >
| >
|
|
Nov 23 '05 #3

G.Ashok wrote:
Hello,

The Type.GetPropert y() method is throwning "AmbiguousMatch Exception"
when getting value of control class through reflection.
The exception occurs under the following cases.
1. The class is derived from other class
2. Any of the parent class property is either overridden or shadowed in the
derived class
3. and trying to get the property value through reflection of the derived
class.


Could you show us some code that gives this problem? When I construct a
test harness doing what you say, it works fine for me.

--
Larry Lard
Replies to group please

Nov 23 '05 #4

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

Similar topics

2
1579
by: Symphony | last post by:
Hi, all: I am using ie6 and vb.net developing the web site. on one .aspx page , we have several radio buttons( we did not use radio button list), only one of these button can be seleted. so I uesed on button checked change event to contro all those buttons.( these button have set to be autopostback=true),when I click on one button, the page...
13
2059
by: Will Pittenger | last post by:
I have a Control derived class. When the parent of the control changes the control's Location property, the stack overflows. I have not found a way to find out what was on the stack when it does overflow. All I know is that the program is either stopped due to an exception at the end of Main or has exited after the Stack Overflow exception....
4
2670
by: Pieter Linden | last post by:
Hi, Hopefully it's just me missing something obvious (but at 2AM, not much is obvious, I guess...) I have a table of courses that people have taken (StudentID,CourseID) and the user selects a student from a combobox on the form, and it highlights courses in the student's specialization (that's fine). But when I run the code to change the...
2
3010
by: steve bull | last post by:
I have created a label control and got it to appear in the toolbox. The problem I have is that while all the other properties appear for the contro I can't get the Text property to appear at all. I have tried in both the DataBindings category and the Appearance category but it won't appear in either. Am I missing something or do I have to do...
3
5656
by: Luis Esteban Valencia | last post by:
A page let of work for me I commented almost all lines but nothing the code is this
1
1384
by: Symphony | last post by:
Hi, all: I am using ie6 and vb.net developing the web site. on one .aspx page , we have several radio buttons( we did not use radio button list), only one of these button can be seleted. so I uesed on button checked change event to contro all those buttons.( these button have set to be autopostback=true),when I click on one button, the page...
1
1102
by: Sridhar | last post by:
Hi, I have created a webpage. In that webpage I am loading a user control into a place holder. The user control has a link button in it. when I click on that I need to able to load another user control in place of this into a place holder. I am not knowing how to do that. Could you please let me know. Or if my design of using user controls...
2
1116
by: Prabhudhas Peter | last post by:
How to Create an User Defined Property, which stores value for each index of the Combo Box User Control.(each value is related to the item stored in the ComboBox) -- Peter...
7
1970
by: WT | last post by:
Hello, It seems that when a control is set into a ContentPlaceHolder in a page using a MasterPage, it's id is change and FindControl(ID) no more works, is it normal, how to override this or retrieve the controls OnInit handler with a FindControl ? Thanks again for help. CS
0
7449
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...
0
7385
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...
0
7642
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. ...
0
7796
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...
0
5950
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5316
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4938
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...
0
3432
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
688
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.