Home All Groups Group Topic Archive Search About
Author
22 Sep 2006 8:53 PM
David Miller
Help,

I give up...  I have a class that I created.

In the Load call of a custom control I bind a text box to the class that I
created.
The code for that part  is: TxtLast.DataBindings.Add(New Binding("Text",
CurrentRecord, "LastName"))

If I change the value of the class in the Load call the text box that it
bound to updates with the new value. So if within the Load Proc of the
control there is a line that says CurrentRecord.Lastname = "Smith" the text
box will display "Smith".

But, if I change the value in any other procedure within that control the
textbox does not update it's value.  What am I doing wrong?

Thanks,
David

Author
23 Sep 2006 2:23 PM
Bart Mermuys
Hi,

Show quoteHide quote
"David Miller" <dmiller1***@earthlink.net> wrote in message
news:T2YQg.9958$fb3.9955@fe07.news.easynews.com...
> Help,
>
> I give up...  I have a class that I created.
>
> In the Load call of a custom control I bind a text box to the class that I
> created.
> The code for that part  is: TxtLast.DataBindings.Add(New Binding("Text",
> CurrentRecord, "LastName"))
>
> If I change the value of the class in the Load call the text box that it
> bound to updates with the new value. So if within the Load Proc of the
> control there is a line that says CurrentRecord.Lastname = "Smith" the
> text box will display "Smith".
>
> But, if I change the value in any other procedure within that control the
> textbox does not update it's value.  What am I doing wrong?

If you are using NET1.1 then add an event (typeof EventHandler) for each
property and name it "propertyname"+Changed, eg:

Public Class Class1
  Private _LastName As String

  Public Event LastNameChanged As EventHandler
  Public Property LastName() As String
    Get
        Return _LastName
    End Get
    Set(ByVal value As String)
      If (value <> _LastName) Then
         _LastName = value
         RaiseEvent LastNameChanged(Me, EventArgs.Empty)
       End If
    End Set
  End Property

End Class

This should work in NET2.0 too, but in NET2.0 i would implement the new
INotifiyPropertyChanged instead on your class.

HTH,
Greetings


Show quoteHide quote
>
> Thanks,
> David
>