473,396 Members | 1,968 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,396 software developers and data experts.

Component that allows binding to it

ogs
I need to create component that allows binding to it's properties. Maybe
there exists some interface or something.
Like:

================================================== =
public class Cat : Component, ISomeBindInterface{
private String pCatName;
public String CatName{
get {return pName;}
set {pName = value;}
}
}

...

Cat Tom = new Cat();
TextBox txt = new TextBox();

txt.DataBindings.Add(new System.Windows.Forms.Binding("Text", Tom,
"CatName", true));
==================================================
It will be very good to see this component in design-time in VS (I know how
to do that). It needs the same functionality as all other components like
DataSet etc. - setting bindings through PropertyGrid.
Thanks a lot.
Nov 16 '05 #1
1 1173
i've just been through this.

binding is automatic (one-way) - i.e. from the control to the porperty of
the business object (cat)

you should find, when you bind like you have shown in example, when you tab
off the textbox (txt) the CatName property will automatically change.

The problem you'll experience is binding (pulling) data from the object.
The data binder listens for <PropName>Changed event.
What you need to do is...

public class Cat : Component, ISomeBindInterface{
private String pCatName;
public event EventHandler CatNameChange;
public String CatName{
get {return pName;}
set {
pName = value;
if (CatNameChanged!=null)
CatNameChange(this, new EventArgs());
}
}
}

HTH
Sam
"ogs" <og*@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com...
I need to create component that allows binding to it's properties. Maybe
there exists some interface or something.
Like:

================================================== =
public class Cat : Component, ISomeBindInterface{
private String pCatName;
public String CatName{
get {return pName;}
set {pName = value;}
}
}

...

Cat Tom = new Cat();
TextBox txt = new TextBox();

txt.DataBindings.Add(new System.Windows.Forms.Binding("Text", Tom,
"CatName", true));
==================================================
It will be very good to see this component in design-time in VS (I know
how
to do that). It needs the same functionality as all other components like
DataSet etc. - setting bindings through PropertyGrid.
Thanks a lot.

Nov 16 '05 #2

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

Similar topics

1
by: Scott Holmes | last post by:
I'm experiencing what seems to be strange behaviour. I don't know if it's Pmw, Tkinter on Python. I have a button, defined in a Pmw.buttonbox, that I would like to configure to "sunken" after it...
8
by: Carel Lotz | last post by:
H We have ported our VB 6 application into VB .NET but are still integrating with a few COM + applications written in VB6 running on our application server (Win 2000 Server). We have the proxies...
0
by: Jason | last post by:
What interface do I need to implement in order to get a component with a public property to show up in the data binding drop down boxes at design time in VS.net? I've tried to look just about...
3
by: gabe | last post by:
I have a general design question. What's a 'Best Practice' for middle tier component design? I'm thinking of a web form that contains data from multiple tables. The data is supplied from one...
1
by: jokolee | last post by:
i was using component AxSHDocVw.AxWebBrowser,,but i rather confuces because when i write AxWebBrowser1.Document. the next option is Gettype function,,,nothing else...... But when i write...
1
by: Rocio | last post by:
I have a windows app. written in VB6, now we need to expose some of its classes through a web service. I am only able to expose the classes using late binding becasue that's the way the original...
7
by: jwang | last post by:
I am trying to instantiate a COM component in C# via late binding. The component appears to be launched, then it automatically gets unloaded. That is, the instance is unloaded after the...
122
by: Edward Diener No Spam | last post by:
The definition of a component model I use below is a class which allows properties, methods, and events in a structured way which can be recognized, usually through some form of introspection...
1
by: Igor Ladnik | last post by:
We are dealing with .NET server component and COM clients written with VB6 and VBScript. And there are some problems we faced (please see code below). 1. Managed type System Drawing.Color is...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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
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...

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.