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

C# WinForms: Accessing same TextBox control with 2 variables

Hi all,

I have some class that's managing the user interface - CMan, and I'm passing it the struct array with some txtboxes in it. CMan than changes txtboxes.

This struct is initialized like this:
Expand|Select|Wrap|Line Numbers
  1. struct STxt { public TextBox data1; public TextBox data2;};
  2. STxt [] myArray;
  3.  
  4. myArray = new STxt[10];
  5. myArray[0].data1 = txtFirstBox; //txtFirstBox is a TextBox
  6. myArray[1].data1 = txtSecondBox;
  7. //...
  8.  
  9. CMan handler = new CMan(myArray);
  10.  
Problem is when I change txt box in CMan it doesn't reflect to myArray, so in the watch screen I have a following situation at the same time:

Expand|Select|Wrap|Line Numbers
  1. txtFirstBox.Text = "Sample text";
  2. handler.TxtArray[0].data1.Text = "Changed text"; 
  3.  
I've eliminated all the typo-errors, and am very puzzled right now... the TextBox isn't a value type, and when I assign it like that to another variable I can use it's properties with both variables (the target should be the same).... right?
(I guess I can solve it by using unsafe code via pointers, but I'd like to avoid this if possible)
Feb 22 '08 #1
1 1253
Forget about it - it's definitely a typo - I forgot to add property on one assignment (i.e. instead of data1.Text= I wrote data1 =.... it was really freaking me out for 4hrs now....)
Feb 22 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jacek Jurkowski | last post by:
I wrote my own WinForm controls inherited from standard controls f.e. formatted TextBox etc... All worked perfectly with Vs.net 2002 but when i add my controls to a form visually with 2003 version...
2
by: David Adams | last post by:
Hi, I am afraid I am asking a very basic question, or just something that is not possible. I have a WinForm app that contains a Form (Form A), and then 20-30 UserControls/WinForms that are...
2
by: EddieG | last post by:
I am having a problem accessing changed values in TextBoxes returned via the OnUpdaterow event. Using C# I access the control using: string _txtAmt = ((TextBox)e.Item.FindControl("txtAmount")).Text ...
4
by: John Holmes | last post by:
I'm using data to rename some web controls on a form that uses a repeater contol and so it can have mulitple instances of the same control set. The controls get renamed (thanks to Steven Cheng's...
1
by: | last post by:
This is a crosspost from a less-frequented (but more focused) asp.net group; I didn't receive an answer that worked. I'd like to get this form functional. Could someone help on what's probably a...
9
by: Blake Weaver | last post by:
Ok, this is probably a no-brainer for most of you but its escaping me and I can't even seem to find the answer in any documentation. How do you access a friend variable of one class, from another...
0
by: jonathan.beckett | last post by:
I have been working on a client project recently that is using winforms ..NET user controls within web pages in Internet Explorer, and need to find out how to make the user control communicate back...
0
by: Andreas Draheim | last post by:
Hi all, I try to get the quickstart from the .NET 1.1 hosting a WinForms Control in IE running in .NET 2.0. But I cant get it going....
1
by: nmahesh567 | last post by:
Hi All, I have a following task to be implemented in my project and I would like to know ideas and best possible solution with little code from you guys. Please let me know and any help would be...
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: 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
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,...
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
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...
0
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,...

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.