473,324 Members | 2,511 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,324 software developers and data experts.

Accessing textbox via reflection

Hi gang,

I am trying to access the controls on an .ascx via reflection, but cannot seem to figure out which of the "Get..." methods on the type to call to do it.

I have a page with a textbox called "txtFirstName" on it, and what I am trying to do is fill the textbox with data from a domain object. My code to access the textbox is:

Dim dispCompInfo As System.Reflection.FieldInfo
dispCompInfo = Me.GetType.GetField("txtFirstName", Reflection.BindingFlags.NonPublic | Reflection.bindingflags.Instance)

but it keeps coming up with nothing or I get an error that a message is being passed to an object that equals nothing. I have tried other Get... methods on Type, but none seem to yield the textbox. What am I doing wrong?

Also, once I get the textbox, do I need to get property info for the "Text" property in order to set a value in it, or is there some other more convenient/clever way to do that?

Thanks for any input!

Cheers,

Chris
--------------------------------
From: Christopher Burns

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>PoIr0gOUwUGSafD2noiB7w==</Id>
Nov 21 '05 #1
0 962

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

Similar topics

0
by: Jason Coyne Gaijin42 | last post by:
I have seen several people looking for a way to access the Columns collection when using the AutoGenerateColumns = true option. Some people have gotten so far as to find the private...
0
by: Jason Coyne Gaijin42 | last post by:
I have seen several people looking for a way to access the Columns collection when using the AutoGenerate = true option. Some people have gotten so far as to find the private autoGenColumnsArray...
2
by: Bluelace | last post by:
I have a screen which has as number of textboxes on a screen which I wish to initialise using a loop. The textboxes are named textBox1, textBox2 etc. I hoped I hoped that I could address the...
9
by: nail | last post by:
Hi. So I have a default.aspx page and 3 WebUserControls In the WebUserControl1, I have on TexBox, and in the default.aspx page I have a Button control. On the click event of the default.aspx page...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
3
by: GizMo | last post by:
Hi all, I'm wondering if it is possible in C# ( + Reflection ) to do something like this : Assume that a Server.exe ( which is a .Net assembly, let's say WindowsApplication ) is running on th...
1
by: zumbo | last post by:
I'm accessing MSOutlook via Microsoft.Office.Interop.Outlook. It works fine if I add a reference to either version 11 (Outlook 2003) or version 12 (Outlook 2007) of the interop assembly to my...
2
by: Jay | last post by:
Is there a way to access the actual datatype of a property when looking at the PropertyInfo? For example: Property defined: public Nullable<DateTimeEndDate { get { return endDate; }
2
by: thisismykindabyte | last post by:
Hey-o! Can anyone tell me how to make this work? Long story short, I would like to use text from TextBox1.Text as the functions I would like to call. Then I would like TextBox1.Text to show...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: 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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.