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

Inheriting classes

This is probably a basic c# question, but I'm having problems with it.

I currently have a project that contains two classes. From the calss view.

Class1
Class2

I have included a usercontrol in class 2. I dropped the control into a
form in class one. What I'm looking to do is fill a control's text box
with information from Class1.

(string)Class1.button1.text = (string)Class2.ClassState.Info;

Any help would be appreciated.

Kevin
Nov 15 '05 #1
2 1394
If I understand the problem, usercontrols wrap the contents within, meaning
that you normally do not interact with controls in the usercontrol. What
you can do is make your textbox variable in your UC public, or expose a
property on the usercontrol that will delegate the commend to the textbox.
"Kevin Blackwell" <ak********@yahoo.dot.com> wrote in message
news:6u********************@speedsite.com...
This is probably a basic c# question, but I'm having problems with it.

I currently have a project that contains two classes. From the calss view.

Class1
Class2

I have included a usercontrol in class 2. I dropped the control into a
form in class one. What I'm looking to do is fill a control's text box
with information from Class1.

(string)Class1.button1.text = (string)Class2.ClassState.Info;

Any help would be appreciated.

Kevin

Nov 15 '05 #2
Hi
since you put your usercontrol into class one this means that it is a
member of class one now .. this will allow you ta access all data of class
one .
however to get that data to the textbox control " i think it is a member of
your user control" , you sould make this textbox a public member of the
user control .. this way you can access its text property. Another way to
do it is to write a property of the usercontrol that set and get the text
property of the internal textbox control. this way you don't have to change
the textbox from private to public and it is also a better practice.
hope that would help

Nov 15 '05 #3

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

Similar topics

1
by: john diss | last post by:
hello there everyone.. I have created a class called "ProcessLog" inheriting from XmlDocument and two classes ("UploadedItem", "ProcessError") inheriting from XmlElement. I then have two...
2
by: Peter Bates | last post by:
Hi, I'm just getting used to XSDObjectGen and i have the following question. Can i use a class inherited from a class generated by XSDObjectGen with XmlSerialize? Specifically, I have many...
6
by: Russell Mangel | last post by:
Jeffery Richter makes the following statement in two books, the first was written in 2004, the latter in 2002. "You should not define new exception classes derived from ApplicationException; use...
24
by: toton | last post by:
Hi, I want to have a vector like class with some additional functionality (cosmetic one). So can I inherit a vector class to add the addition function like, CorresVector : public...
7
by: Amu | last post by:
Hi i am stuck up in a part of project where i have to inherit the VC++ template classes into C#.net. Please provide me the solution for this .
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...
1
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: 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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.