473,387 Members | 1,892 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,387 software developers and data experts.

GetProperty

Hi:

How to use GetProperty to return the TextBox.Font.Name property ?

Dim propInfo As PropertyInfo = ctrl.GetType.GetProperty("Font",
BindingFlags.Public Or BindingFlags.NonPublic Or BindingFlags.Static
Or BindingFlags.Instance Or BindingFlags.IgnoreCase)

will return the Font property, how to reference the Name property in
then propInfo ?

Thanks
JCVoon

Nov 21 '05 #1
2 1655
JC Voon schrieb:
How to use GetProperty to return the TextBox.Font.Name property ?

Dim propInfo As PropertyInfo = ctrl.GetType.GetProperty("Font",
BindingFlags.Public Or BindingFlags.NonPublic Or BindingFlags.Static
Or BindingFlags.Instance Or BindingFlags.IgnoreCase)

will return the Font property, how to reference the Name property in
then propInfo ?


Untested: 'PropertyInfo' has a 'PropertyType' property that will return
the type of the property. Then you can use 'GetProperty' on the font's
type to get the name property.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #2
Herfried K. Wagner:
Untested: 'PropertyInfo' has a 'PropertyType' property that will return
the type of the property. Then you can use 'GetProperty' on the font's
type to get the name property.


Thanks for the reply, now i can get the Font.Name property,

Public Const MemberAccess As BindingFlags = BindingFlags.Public Or
BindingFlags.NonPublic Or BindingFlags.Static Or BindingFlags.Instance
Or BindingFlags.IgnoreCase

Dim fontPropInfo As PropertyInfo = ctrl.GetType.GetProperty("Font",
MemberAccess)
Dim fontNamePropInfo As PropertyInfo = fontPropInfo
..PropertyType.GetProperty("Name")

But how to Get or Set the property value, The GetValue and SetValue
need the instance reference, but i don't know how to get the reference
from the fontNamePropInfo

fontNamePropInfo.GetValue( ??, nothing )

Thanks
JCVoon
Nov 21 '05 #3

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

Similar topics

0
by: Rick Strahl [MVP] | last post by:
A while back I've built a bunch of generic Reflection routines that simplify the process of access properties/fields and methods a bit easier by creating wrappers around Property/Field/Method info...
2
by: Robert Zurer | last post by:
I have two interfaces one inherits from the other public interface IEmployee { string FirstName{get; set;} string LastName{get; set;} } public interface IHRMSEmployee : IEmployee {
15
by: satankidneypie | last post by:
Hi, I'm going to start this off with some code as it'll make it easier to explain afterwards... using System; namespace ConsoleApplication1 { /// <summary>
2
by: crabel | last post by:
I have a class that intiatizes another class and exposes that class as a property. So basically: Class 1 Inits Class 2 and exposes it as a property Is there a way to query class 1 to get...
1
by: Judy K | last post by:
Greetings all, I am new to Java, JSP and javascripting. I was passing parameters in a query string and have learned the dangers therein, so am now trying to pass a parameter as a javabean property...
3
by: Judy K | last post by:
Greetings, Trying to assign a javabean property and get it in another page with <jsp:getProperty .... I can get it in the same page, but in different page it is always null. scope =...
2
by: Carlos Rodriguez | last post by:
I have the following function in C#public void Undo(IDesignerHost host) { if (!this.componentName.Equals(string.Empty) && (this.member != null)) { IContainer container1 = (IContainer)...
5
by: dig_dug_d | last post by:
Hello, I have been struggling with the SetValue method when trying to use indexed items. I can't figure out what needs to be done to create the "index As Object()" parameter. Juding from the...
3
Fr33dan
by: Fr33dan | last post by:
I'm having trouble getting the Type.GetProperty(string) method to return the property that I need. Whenever I call it all I get is a null value even thought the type that i'm calling does contain the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...

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.