473,473 Members | 1,475 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Custom Object Databinding Question

I have the following persudo code:

//My Form Class
class Form1 {

//Local Variable for my custom object
private MyCustomObject1

//Constructor for Form Class
public Constructor{
MyCustomObject1 = new MyCustomObject1();
MyCustomObject1.MyProp = "Test";
textbox.databindings.add("text", this._MyCustomObject1, "MyProp1");
}

public ChangeCustomObject {
MyCustomObject1 = new MyCustomObject1();
MyCustomObject1.MyProp = "Change Test";
}

}

//Custom Class the contains one Property
class MyCustomObject {

property string MyProp1;

}

I databind a text boxes text property to my MyCustomObjects MyProp1 property
once in the constructor. This works fine, if I update the text box, the
value for MyProp1 is also updated. But if I change MyCustomObject1 to a new
MyCustomObject, the text box is not updated unless I call the
Databindings.Add again. Is this suppose to work this way? Do I have to
call Databindings.Add each time I set myCustomObject1 to a new
myCustomObject?

Thanks in advance,
--
Frank Wisniewski MCSE 4.0, MCP+I, A+
f p w 2 3 @ h o t m a i l . c o m

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 16 '05 #1
3 1959
Yes, it is supposed to work that way. You could make a container for your
custom object and make your 'changable' custom object just a property in
that container (and add your data binding to the container, which would
never change). But unless you do something like that you will have to
re-bind each time.

Richard

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Frank Wisniewski" <fp***@hotmail.com> wrote in message
news:40**********@127.0.0.1...
I have the following persudo code:

//My Form Class
class Form1 {

//Local Variable for my custom object
private MyCustomObject1

//Constructor for Form Class
public Constructor{
MyCustomObject1 = new MyCustomObject1();
MyCustomObject1.MyProp = "Test";
textbox.databindings.add("text", this._MyCustomObject1, "MyProp1"); }

public ChangeCustomObject {
MyCustomObject1 = new MyCustomObject1();
MyCustomObject1.MyProp = "Change Test";
}

}

//Custom Class the contains one Property
class MyCustomObject {

property string MyProp1;

}

I databind a text boxes text property to my MyCustomObjects MyProp1 property once in the constructor. This works fine, if I update the text box, the
value for MyProp1 is also updated. But if I change MyCustomObject1 to a new MyCustomObject, the text box is not updated unless I call the
Databindings.Add again. Is this suppose to work this way? Do I have to
call Databindings.Add each time I set myCustomObject1 to a new
myCustomObject?

Thanks in advance,
--
Frank Wisniewski MCSE 4.0, MCP+I, A+
f p w 2 3 @ h o t m a i l . c o m

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---
Nov 16 '05 #2
Thanks Richard, but let me take it a step deeper now,

Lets say my form1 class has a public property called myFormCustomObject
which returns the private variable MyCustomObject1. If I bind a textboxes
text property to a property of the mycustomobject property of the form like
so:

this.textbox.databindings.add("text", this, "myFormCustomObject");

should this work,

because I have it set this way in my code now and it does not work for me.
Am I binding the wrong way or something.

--
Frank Wisniewski MCSE 4.0, MCP+I, A+
f p w 2 3 @ h o t m a i l . c o m
"Richard A. Lowe" <ch*****@yumspamyumYahoo.com> wrote in message
news:Oy**************@TK2MSFTNGP12.phx.gbl...
Yes, it is supposed to work that way. You could make a container for your
custom object and make your 'changable' custom object just a property in
that container (and add your data binding to the container, which would
never change). But unless you do something like that you will have to
re-bind each time.

Richard

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Frank Wisniewski" <fp***@hotmail.com> wrote in message
news:40**********@127.0.0.1...
I have the following persudo code:

//My Form Class
class Form1 {

//Local Variable for my custom object
private MyCustomObject1

//Constructor for Form Class
public Constructor{
MyCustomObject1 = new MyCustomObject1();
MyCustomObject1.MyProp = "Test";
textbox.databindings.add("text", this._MyCustomObject1, "MyProp1");
}

public ChangeCustomObject {
MyCustomObject1 = new MyCustomObject1();
MyCustomObject1.MyProp = "Change Test";
}

}

//Custom Class the contains one Property
class MyCustomObject {

property string MyProp1;

}

I databind a text boxes text property to my MyCustomObjects MyProp1

property
once in the constructor. This works fine, if I update the text box, the
value for MyProp1 is also updated. But if I change MyCustomObject1 to a

new
MyCustomObject, the text box is not updated unless I call the
Databindings.Add again. Is this suppose to work this way? Do I have to
call Databindings.Add each time I set myCustomObject1 to a new
myCustomObject?

Thanks in advance,
--
Frank Wisniewski MCSE 4.0, MCP+I, A+
f p w 2 3 @ h o t m a i l . c o m

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via

Encryption =---


Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 16 '05 #3
Sorry, I just reread my last post and I missed something, I meant the line
of code to read:

this.textbox.databindings.add("text", this.myFormCustomObject, "MyProp1");

--
Frank Wisniewski MCSE 4.0, MCP+I, A+
f p w 2 3 @ h o t m a i l . c o m
"Frank Wisniewski" <fp***@hotmail.com> wrote in message
news:40**********@127.0.0.1...
Thanks Richard, but let me take it a step deeper now,

Lets say my form1 class has a public property called myFormCustomObject
which returns the private variable MyCustomObject1. If I bind a textboxes
text property to a property of the mycustomobject property of the form like so:

this.textbox.databindings.add("text", this, "myFormCustomObject");

should this work,

because I have it set this way in my code now and it does not work for me.
Am I binding the wrong way or something.

--
Frank Wisniewski MCSE 4.0, MCP+I, A+
f p w 2 3 @ h o t m a i l . c o m
"Richard A. Lowe" <ch*****@yumspamyumYahoo.com> wrote in message
news:Oy**************@TK2MSFTNGP12.phx.gbl...
Yes, it is supposed to work that way. You could make a container for your custom object and make your 'changable' custom object just a property in
that container (and add your data binding to the container, which would
never change). But unless you do something like that you will have to
re-bind each time.

Richard

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Frank Wisniewski" <fp***@hotmail.com> wrote in message
news:40**********@127.0.0.1...
I have the following persudo code:

//My Form Class
class Form1 {

//Local Variable for my custom object
private MyCustomObject1

//Constructor for Form Class
public Constructor{
MyCustomObject1 = new MyCustomObject1();
MyCustomObject1.MyProp = "Test";
textbox.databindings.add("text", this._MyCustomObject1, "MyProp1");
}

public ChangeCustomObject {
MyCustomObject1 = new MyCustomObject1();
MyCustomObject1.MyProp = "Change Test";
}

}

//Custom Class the contains one Property
class MyCustomObject {

property string MyProp1;

}

I databind a text boxes text property to my MyCustomObjects MyProp1

property
once in the constructor. This works fine, if I update the text box, the value for MyProp1 is also updated. But if I change MyCustomObject1 to a
new
MyCustomObject, the text box is not updated unless I call the
Databindings.Add again. Is this suppose to work this way? Do I have

to call Databindings.Add each time I set myCustomObject1 to a new
myCustomObject?

Thanks in advance,
--
Frank Wisniewski MCSE 4.0, MCP+I, A+
f p w 2 3 @ h o t m a i l . c o m

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World!

100,000
Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via

Encryption
=---


Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 16 '05 #4

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

Similar topics

3
by: DraguVaso | last post by:
Hi, I'm having the following situation: - A class clsFournisseur with public property's which raise a MyPropertyChanged-event in the Set-method for each Property. Public Event NomChanged As...
1
by: glenn | last post by:
I have written as a test a customer class that has all the necessary field handling and formatting routines in it that I need. I have dataaccess class that controls reading and writing the class...
2
by: Jay Walker | last post by:
I created a custom DataGridColumn based on Marcie Robillard's MSDN Article: Creating Custom Columns for the ASP.NET Datagrid...
7
by: Girish | last post by:
OK.. phew. Playing with data grids for the past few days has been fun and a huge learning experience.. My problem. I have a requirement to display a gird with a gird. Within the embedded grid,...
1
by: Mike Hofer | last post by:
I am trying to do something a little nonstandard, and am having some difficulty determining (a) if it can be done and (b) if so, how to do it. What I want to do is fill a dropdown combobox with...
0
by: matrix1975 | last post by:
Hi everybody, I'm migrating my ASP.NET 1.1 portal to 2.0. In my previous version I had implemented a data binding framework for the presentation layer. Basically a property of a Business Object...
9
by: Jaybuffet | last post by:
my aspx has something like this <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>' showItem="true"/> </ItemTemplate>...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
1
by: Charles Bazi | last post by:
Hi, Based on MSDN http://msdn2.microsoft.com/en-us/library/7tas5c80.aspx smple, I have made my custom DataGridViewColumn. I use it to host a custom control, sort of ComboBox, but instead of...
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
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...
1
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...
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,...
1
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
0
muto222
php
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.