473,378 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Databinding problem

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
Nov 20 '05 #1
3 799
"Eric Fleet" <Eric Fl***@discussions.microsoft.com> schrieb
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.dat abinding
--
Armin

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

Nov 20 '05 #2
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
Nov 20 '05 #3
Hi,

Your class needs to Implements IEditableObject to be editable when data
bound.

http://msdn.microsoft.com/library/de...classtopic.asp
Ken
------------------

"Eric Fleet" <Eric Fl***@discussions.microsoft.com> wrote in message
news:C5**********************************@microsof t.com:
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


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.1.2 - Release Date: 6/7/2004
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mantorok | last post by:
Hi I'm attempting to bind a Textbox.Text property to a custom object/property in C#. My form has an instance of my class in a property called Integration, I'm attempting to bind the textbox by:...
2
by: Olivier Deborne | last post by:
Hello, I have two classes A & B public class A : B { private string lastname; public string LastName {
4
by: Davie | last post by:
How can I bind the following to a comboBox in the compact framework? I'm looking at this example here:...
0
by: GMK | last post by:
Dear all i'm facing a problem while binding my textbox controls on my webform to a value in the dataset. the binding is being made visually. so when i run my application i get the following error...
2
by: Nosaj | last post by:
Houston, we've got a problem... In a ascx file, I bind a datasource with a dropdownlist. The following code runs perfectly in a aspx file but not in a ascx file. And I just can't understand it....
0
by: Fabuloussites | last post by:
I have a page that has multiview control that has two dropdown lists on it. the dropdown controls ARE NOT inside of the multiview. Each drop down is bound using its own sqldatasource conrtol. The...
0
by: bnolingberg | last post by:
Hi all. I've been stuck on this problem for a while (I'm a newbie). I have a listbox with several collection objects, some of them being identical. When one of the collection items is selected...
7
by: Vlado Jasovic | last post by:
Hello, I'm using typed dataset for databinding to windows controls and I'm having some problems. I'm trying to move all business logic to datatable column_changing events and the problem that...
2
by: David C | last post by:
I have a drop down list control where I set AppendDataBound to true and added a list item of '<< add new>>' with a value of -1 to use for adding items to the list during data entry. When the user...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.