473,588 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Binding between objects

I'm desperate! :-/.

I'm desperately trying to bind to objects together to share same data and to display it in a windows forms.

I'm trying to bind an custom object to custom control property. I do have integer selectionid "targetid" in my control and I'm trying to bind the (int) selectionid "sourceid" from my custom data source.

How can it be done? I've tried the following with no luck:

control.DataBin dings.Add( "targetId", myCustData, "sourceId" );

How can this be achieved? Please help. Thanks in advance.

Nov 16 '05 #1
1 1586
Antero,
I'm desperately trying to bind to objects together to share
same data and to display it in a windows forms.

I'm trying to bind an custom object to custom control
property. I do have integer selectionid "targetid" in
my control and I'm trying to bind the (int) selectionid
"sourceid" from my custom data source.
The following article covers binding objects to controls.

http://msdn.microsoft.com/library/de...et02252003.asp

Here is a (VB.NET) sample binding to multiple properties, with
notifications:

Public Class Person

Public Event Text1Changed As EventHandler
Public Event Text2Changed As EventHandler

Private m_text1 As String
Private m_text2 As String

Public Sub New()
m_text1 = String.Empty
m_text2 = String.Empty
End Sub

Public Property Text1() As String
Get
Return m_text1
End Get
Set(ByVal value As String)
m_text1 = value
OnText1Changed( EventArgs.Empty )
End Set
End Property

Public Property Text2() As String
Get
Return m_text2
End Get
Set(ByVal value As String)
m_text2 = value
OnText2Changed( EventArgs.Empty )
End Set
End Property

Protected Overridable Sub OnText1Changed( ByVal e As EventArgs)
RaiseEvent Text1Changed(Me , e)
End Sub

Protected Overridable Sub OnText2Changed( ByVal e As EventArgs)
RaiseEvent Text2Changed(Me , e)
End Sub

End Class
Public Class PersonForm
Inherits System.Windows. Forms.Form

' ... designer generated code

Private aPerson As New Person

Private Sub Person_Load(ByV al sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Me.TextBox1.Dat aBindings.Add(" Text", aPerson, "Text1")
Me.TextBox2.Dat aBindings.Add(" Text", aPerson, "Text2")
End Sub

End Class
Hope this helps
Jay
"Antero" <An****@discuss ions.microsoft. com> wrote in message
news:CE******** *************** ***********@mic rosoft.com... I'm desperate! :-/.

I'm desperately trying to bind to objects together to share same data and to display it in a windows forms.
I'm trying to bind an custom object to custom control property. I do have integer selectionid "targetid" in my control and I'm trying to bind the
(int) selectionid "sourceid" from my custom data source.
How can it be done? I've tried the following with no luck:

control.DataBin dings.Add( "targetId", myCustData, "sourceId" );

How can this be achieved? Please help. Thanks in advance.

Nov 16 '05 #2

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

Similar topics

0
1469
by: Paul Keating | last post by:
I want my Python COM object to do early binding. I have this working for methods that return floats and dates and variants, but not for methods that return COM objects. They are returning IDispatch objects and not the specific COM objects that the client code is expecting. I've got to the point that makepy reads my type library and generates this class: class IArena_MarketDataServer_CurrenciesData(DispatchBaseClass): #This class is...
1
1271
by: Raed Sawalha | last post by:
the first thing I searched the internet is what is the XML Binding? also while I;m reading the eSCORTE4js for SCORM i noticed the following comment // these functions handle the conversion to/from the IEEE 1484_11_3 XML binding values what this means?
7
3031
by: PC Datasheet | last post by:
I have this: Dim Cbr As Object Dim Ctl As Object Set Cbr = Application.Commandbars("CourseCalendarMonth") Set Ctl = Application.Commandbars("CourseCalendarMonth").Controls("CalendarMonth") Is this considered late binding? If not, what needs changed? Thanks!
9
10404
by: Zlatko Matiæ | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws As DAO.Workspace Dim db As DAO.Database Dim qdf As DAO.QueryDef Dim rs As DAO.Recordset
1
2591
by: matty.hall | last post by:
There's a lot of information out there about data-binding UI objects (i.e. derived from Control) to non-UI custom business objects. Is it possible to do the same without any UI being involved at all? Here's an example: I want to do data binding on some of the properties of a TreeNode (namely its Name). Unfortunately, TreeNode does not derive from Control, so it doesn't have the "stock" data binding stuff. I'd like to create a new...
0
1445
by: Ian | last post by:
I have sub-classed the Page class in order to provide some base properties and methods that every page on my site will need access to. I would like to have these things show up in the Simple Binding window of the DataBindings dialog. I then found this site (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxurfDataBindingsDialogBox.asp) which says: The tree view displays these objects: the Page object; any...
5
1869
by: Plat | last post by:
Summary: I've got some *.ASPX pages that still use COM objects. I'd like to enable Option Strict, but I get "error BC30574: Option Strict On disallows late binding" errors. How can I bypass this problem WITHOUT moving my code out of the *.ASPX page or pre-compiling it, and WITHOUT rewriting the COM objects as managed .NET code? Disclaimer: I understand there is a performance penalty when accessing COM objects from managed code, and...
4
1968
by: Alan Silver | last post by:
Hello, I'm trying to use an ArrayList to do data binding, but am getting an error I don't understand. I posted this in another thread, but that was all confused with various other problems, which could be why no-one answered it!! I've now narrowed the problem down, so am starting a new, more specific, thread. Sorry it's a bit long, but it's reasonably simple stuff. I have a page where I'm showing product details, including any
10
1907
by: Fares Eidi | last post by:
I am a VB6 intermediate programmer just starting out using VB.net and would like to ask what I'd be missing out on if I just use time saving techniques like data binding, data adapter wizards etc to create my front end application. Building the data access forms using manual coding just seems like a lot of work.... Any guidance would be appreciated Fares
0
7929
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7862
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8228
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7987
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5729
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2372
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 we have to send another system
1
1459
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.