D
DraguVaso
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 EventHandler
Public Property Nom() As String
Get
Return m_strNom
End Get
Set(ByVal Value As String)
m_strNom = Value
RaiseEvent NomChanged(Me, New EventArgs())
End Set
End Property
- A Form, with an instance of my clsFournisseur: "Private WithEvents
MyEntreprise As New clsFournisseur".
- Proprty's of this Myentreprise are bound to controls on the Form:
"Me.txtNom.DataBindings.Add("Text", MyEntreprise, "Nom")"
When I change the value in my txtNom.Text, the MyEntreprise.Nom-property is
changed. When I change the MyEntreprise.Nom, my txtNom.Text is changed.
So far so good. BUT:
When in my Form I want to use another clsFournisseur, there isn't anymore
databinding. I do this like this:
- MyEntreprise = New clsFournisseur(intEntrepriseID)
or
- MyEntreprise = New clsFournisseur()
I guess this is normal behaviour because, even when it still has the same
name, it isn't the same class anymore. But I still want to have this
databinding! And a weird thing: the txtNom.Databindings.Count = 1, so the
TextBox thinks there is still the databinding...
Does anybody know how I should do this? Am I doing anything wrong? Should I
Clear all the DataBindings after echt new instance of a class and put them
back?
Any help would be really appreciated.
Thanks a lot in advance,
Pieter
PS: I'm using the CTP from august of Visual Studio .NET 2005
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 EventHandler
Public Property Nom() As String
Get
Return m_strNom
End Get
Set(ByVal Value As String)
m_strNom = Value
RaiseEvent NomChanged(Me, New EventArgs())
End Set
End Property
- A Form, with an instance of my clsFournisseur: "Private WithEvents
MyEntreprise As New clsFournisseur".
- Proprty's of this Myentreprise are bound to controls on the Form:
"Me.txtNom.DataBindings.Add("Text", MyEntreprise, "Nom")"
When I change the value in my txtNom.Text, the MyEntreprise.Nom-property is
changed. When I change the MyEntreprise.Nom, my txtNom.Text is changed.
So far so good. BUT:
When in my Form I want to use another clsFournisseur, there isn't anymore
databinding. I do this like this:
- MyEntreprise = New clsFournisseur(intEntrepriseID)
or
- MyEntreprise = New clsFournisseur()
I guess this is normal behaviour because, even when it still has the same
name, it isn't the same class anymore. But I still want to have this
databinding! And a weird thing: the txtNom.Databindings.Count = 1, so the
TextBox thinks there is still the databinding...
Does anybody know how I should do this? Am I doing anything wrong? Should I
Clear all the DataBindings after echt new instance of a class and put them
back?
Any help would be really appreciated.
Thanks a lot in advance,
Pieter
PS: I'm using the CTP from august of Visual Studio .NET 2005