473,503 Members | 1,657 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Collection Property

hi
Thanx to all, I'm created an usercontrol and writing my
own properties its working fine. But whether i grouped my
properties as unique it works but it won't assign values
to the control

Eg. MyUsercontrol having only one textBox. I'm writing
two properties like FirstName and LastName in separate
class. And in my main class i created object for that
class and write the group property. Like

public class Person
{
string FName;
string LName;
public string FirstName
{
get{return FName;}
set{FName=value;}
}
public string LastName
{
get{return LName;}
set{LName=value;}
}
}

Main Class:

public class MainCls
{
Person p = new Person();
[TypeConverter(typeof(ExpandableObjectConverter))]
public Person PersonColl
{
get{return p;}
set{p=value;textBox1.Text = p.FirstName + " " +
p.LastName;}
}

I don't know whether its correct or not. It displays the
properties in the property browser. I'm entered the value
but i won't assign to the textBox control. I wants to
assign that values. Thanx.

Nov 15 '05 #1
1 1223
Looks like you are entering the FName and LName values separately. From
your code, the textbox is not going to get your values this way - because
the variable "p" is being "modified" but not "set".

One way to get around the problem is to move the textbox text assigning code
to the class "Person" - but that breaks the OOP concept.

The other way is to throw in an event "NameChanged" on Person and look for
that event in the main class and update the textbox.

Hope this helps.

-vJ
"Chane" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl...
hi
Thanx to all, I'm created an usercontrol and writing my
own properties its working fine. But whether i grouped my
properties as unique it works but it won't assign values
to the control

Eg. MyUsercontrol having only one textBox. I'm writing
two properties like FirstName and LastName in separate
class. And in my main class i created object for that
class and write the group property. Like

public class Person
{
string FName;
string LName;
public string FirstName
{
get{return FName;}
set{FName=value;}
}
public string LastName
{
get{return LName;}
set{LName=value;}
}
}

Main Class:

public class MainCls
{
Person p = new Person();
[TypeConverter(typeof(ExpandableObjectConverter))]
public Person PersonColl
{
get{return p;}
set{p=value;textBox1.Text = p.FirstName + " " +
p.LastName;}
}

I don't know whether its correct or not. It displays the
properties in the property browser. I'm entered the value
but i won't assign to the textBox control. I wants to
assign that values. Thanx.

Nov 15 '05 #2

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

Similar topics

5
2710
by: Kurt Bauer | last post by:
I have an ASP group calendar application which pulls calendar data from Exchange via webdav into an XML string. I then loop the XML nodes to populate a collection of appointments. Finally I use...
24
5412
by: downwitch | last post by:
Hi, I know this has been covered here and in the .public groups, but it seems like it's been a while, especially around here, so I just thought I'd ask again to see if anyone has figured out a...
2
3155
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the...
2
3287
by: S. Justin Gengo | last post by:
Hi, I've created a component that allows me to store database information for various types of databases my company uses. It uses a collection for each type of database. Everything is working...
10
2748
by: Chet Cromer | last post by:
I am creating a set of base classes and sub classes to use throughout a program I'm developing. The base class represents a generic "lookup table" from my database that contains lists of things...
3
3951
by: Thief_ | last post by:
I want to store data pertaining to a widget in a collection. The widget has many pproperties, so i created the following class and called it "clsWatchProperties": Public Class clsWatchProperties...
4
2492
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
14
2358
by: Rich | last post by:
Yes, I need to store some values in an array type collection object that can hold 3 or more parameters per index. I have looked at the collection object, hashtable object and would prefer not to...
6
7190
by: Arthur Dent | last post by:
How do you sort a generic collection derived from System.Collections.ObjectModel.Collection? Thanks in advance, - Arthur Dent
6
2745
by: Erick | last post by:
I've created a class called Procs and a collection class called Processes which uses a hastable object to store the Procs. Now i want to enumerate with the "For each" to extract all the Procs in...
0
7072
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
7271
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,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6979
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...
0
5570
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,...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
1498
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 ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
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...

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.