Hi all,
Let's say we have a controltab with two tab.
The first tab contains textboxs where entry values are entered
On the second tab are textboxs that display the results.
I have noticed that if I fill up the entry values and create the binding between each textbox and their property and then I destroy it (without clearing the textboxs), the textboxs of the second tab will not display any result.
I have this exemple here
BindingAddition.rar
I do not know how to solve it.
Let's say we have a controltab with two tab.
The first tab contains textboxs where entry values are entered
On the second tab are textboxs that display the results.
I have noticed that if I fill up the entry values and create the binding between each textbox and their property and then I destroy it (without clearing the textboxs), the textboxs of the second tab will not display any result.
I have this exemple here
BindingAddition.rar
VB.NET:
Public Class Form1
Public Property Valeur_1 As Double
Public Property Valeur_2 As Double
Public ReadOnly Property Resultat As Double
Get
Return Addition(Valeur_1, Valeur_2)
End Get
End Property
Public Function Addition(ByVal Valeur1 As Double, ByVal Valeur2 As Double) As Double
Return Valeur1 + Valeur2
End Function
Dim binding_tbox1 As New Binding("Text", Me, "Valeur_1")
Dim binding_tbox2 As New Binding("Text", Me, "Valeur_2")
Dim binding_tbox3 As New Binding("Text", Me, "Resultat")
Private Sub Binding_but_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Binding_but.Click
binding_tbox1.ControlUpdateMode = ControlUpdateMode.Never
TextBox1.DataBindings.Add(binding_tbox1)
binding_tbox2.ControlUpdateMode = ControlUpdateMode.Never
TextBox2.DataBindings.Add(binding_tbox2)
TextBox3.DataBindings.Add(binding_tbox3)
TabPage2.Select()
End Sub
Private Sub DestroyBinding_but_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DestroyBinding_but.Click
TextBox1.DataBindings.Clear()
TextBox2.DataBindings.Clear()
TextBox3.DataBindings.Clear()
End Sub
End Class
I do not know how to solve it.