Databinding problem

G

Guest

I have several controls that I want to bind to properties in a class. The code I use to bind is:

txtAddressLine1.DataBindings.Add(New Binding("text", ebtrPlanDetails, "CompanyAddress1"))

Whenever I change the text of the textbox, and try to navigate to another control on the form, it doesn't work. The cursor stays on the text box. Tracing what happens, I see that as soon as I click on another control, the 'Set' property of CompanyAddress1 is called, and that is it.

Any idea what is going on?

Eric
 
A

Armin Zingler

Eric Fleet said:
I have several controls that I want to bind to properties in a class.
The code I use to bind is:

txtAddressLine1.DataBindings.Add(New Binding("text", ebtrPlanDetails,
"CompanyAddress1"))

Whenever I change the text of the textbox, and try to navigate to
another control on the form, it doesn't work. The cursor stays on the
text box. Tracing what happens, I see that as soon as I click on
another control, the 'Set' property of CompanyAddress1 is called, and
that is it.

Any idea what is going on?

Eric

If it's a databinding problem, you might ask at
microsoft.public.dotnet.framework.windowsforms.databinding


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
C

Cor Ligthert

Hi Eric,

When I use the code below there goes nothing wrong, what am I missing?

Cor

Dim tst As New test
Private Sub Form1_Load(ByVal sender As _
Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TextBox1.DataBindings.Add(New Binding("text", tst, "d"))
Me.TextBox2.DataBindings.Add(New Binding("text", tst, "c"))
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show(tst.d & " " & tst.c)
End Sub
End Class
Public Class test
Dim a As String
Dim b As String
Public Property d() As String
Get
Return a
End Get
Set(ByVal Value As String)
a = Value
End Set
End Property
Public Property c() As String
Get
Return b
End Get
Set(ByVal Value As String)
b = Value
End Set
End Property
Public Sub New()
a = "Hallo"
b = "I am here"
End Sub
End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top