473,778 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting Field Value with Reflection?

Hello,

I'm currently using reflection to get some data from an assembly
created from a web form that has elements such as a DataGrid, DataSet,
etc. I also have a label control. Getting the fields, methods, etc
is no problem but where I'm having difficulty is obtaining the text
value assigned to the label (on the button click). I can see the
string in ilDasm.exe but having trouble picking it up with GetValue().
Any info would be appreciated.

Johnny
Nov 15 '05 #1
1 6488
What sort of trouble are you having? Keep in mind, if you're using
Label.Text, and not the private field, you're looking at a property, not a
field, so you having to use the appropriate flags.

Chris

"John" <in**@fretweb.c om> wrote in message
news:6c******** *************** ***@posting.goo gle.com...
Hello,

I'm currently using reflection to get some data from an assembly
created from a web form that has elements such as a DataGrid, DataSet,
etc. I also have a label control. Getting the fields, methods, etc
is no problem but where I'm having difficulty is obtaining the text
value assigned to the label (on the button click). I can see the
string in ilDasm.exe but having trouble picking it up with GetValue().
Any info would be appreciated.

Johnny

Nov 15 '05 #2

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

Similar topics

3
2534
by: tony lock | last post by:
I am writing a simulation program, the main classes inherit from a base class which itself inherits from Control. I am using reflection to serialize these objects including the fields from control. This works perfectly apart from the field text in Control which always comes back null. Although the IDE always shows it having the correct value. Since the IDE presumably uses reflection to show the value, I am at a loss to know why this one...
2
1472
by: Dan | last post by:
hi newsgroup, i need server side validation of user entries. as i do have many fields, i would like to use reflection for checkinng the IsValid property of all the Validators. here is the reflection code i don't understand why i get the following error: Object does not match target type. Description: An unhandled exception occurred during the execution of the
6
20116
by: Sameh Ahmed | last post by:
Hello there I need to get the "PwdLastSet" of a user object to know when he last set his password. I am using DirectoryServices.DirectoryEntry to bind to the user object, but it either gives "Argument 'Prompt' cannot be converted to type 'String'." or when I use .tostring it returns "system._comobject" I even tried to use this line but it also failed dater.FromFileTimeUtc(entry.Properties("pwdlastset").Value) 'ast from type...
12
3607
by: Sadeq | last post by:
Is there a way to read a struct field by field? I want to write a rather general function, like: public string EncodeStruct (struct strct) { .... } which accepts a general struct type, reads it field by field, encodes
20
27798
by: Shawnk | last post by:
I would like to get the class INSTANCE name (not type name) of an 'object'. I can get the object (l_obj_ref.GetType()) and then get the (l_obj_typ.Name) for the class name. I there any way of getting 'l_Fred_my_ins' out of the following. .... My_cls l_Fred_my_ins = new My_cls();
1
1121
by: samhng | last post by:
Hi, Suppose I have a class: public class Test { public string a; public int b; } Now I want to access the value of variable a of the instance of the class Test (@_@). public class App
5
11959
by: jdzemke | last post by:
I am getting 'options' is null or not an object using when using a dynamic dataset with a dropdown list in an html form. I am filling-in a text field and filtering the values in the drop-down. This functionality works with a fixed set of values in the drop-down (i.e. <option value tags). Any insight would be greatly appreciated. <INPUT TYPE="text" NAME="input1" VALUE=""...
4
1481
by: colin | last post by:
How can I access a field contained in fieldInfo by reference so I can pass it to a function ? ive tried __refvalue but this needs a type known at compile time, I can access it with SetValue and GetValue but in one case where the field is a structure I need to pass it as a ref to a function. as it is a structure i cant make a 'new' copy and pass that as a ref and then copy it back.
2
1125
by: gz | last post by:
Good morning everyone, I am writing a module that needs to access fields in classes efficiently. The trouble is that the module does not know the classes beforehand, although the user of the module does know the classes in compile time without resorting to reflection. For example, I have a class A and I also have class Module. It knows nothing about class A, but needs to access field f1. In C or C++, I can tell class Module the offset...
0
9632
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
9471
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
10302
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...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9925
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
8958
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2867
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.