PC Review


Reply
Thread Tools Rate Thread

Custom Object Databinding Question

 
 
Frank Wisniewski
Guest
Posts: n/a
 
      6th Jul 2004
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 =---
 
Reply With Quote
 
 
 
 
Richard A. Lowe
Guest
Posts: n/a
 
      6th Jul 2004
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" <(E-Mail Removed)> wrote in message
news:40eaa7b6$1_1@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

=---


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about Databinding - binding controls to members of my business object. Michael.Suarez@gmail.com Microsoft C# .NET 13 11th Jan 2006 01:41 PM
Databinding to business object David Veeneman Microsoft C# .NET 1 1st Dec 2005 09:20 AM
Databinding to custom properties of a custom class in ASP.NET 2 =?Utf-8?B?SW1hciBTcGFhbmphYXJz?= Microsoft ASP .NET 0 20th Apr 2005 08:34 PM
Custom Object Databinding Question Frank Wisniewski Microsoft C# .NET 3 6th Jul 2004 10:03 PM
Databinding to a business object Tim Jarvis Microsoft C# .NET 15 17th Feb 2004 05:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:33 AM.