473,396 Members | 1,872 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,396 software developers and data experts.

Databinding to custom control, please help

Hello everyone,

VB2003-Winforms

I have a class object (testclass), that I would like to bind parts of to two
custom controls (control1 and control2). The testclass is stored in a hash
table for the life of the client session. Upon first run (Creation of
testclass), the bindings work fine and everyone is happy. However, if I
were to open the testclass again, and bind to my controls again, the
underlying controls (i.e. textboxes) will not release focus. The data is
bound correctly, and reflects the changes that I have made initially. If I
close the form with the terminate x in the top right corner, the data is
stored, I just cannot select another control once I change the data in one
control. I always create a new instance of the form that I will perform the
binding in and dispose of it once it closes.

Control1 is a simple control with two radioboxes on it, (OptionA, OptionB)
and I expose a property SelectedOption. The second control has four
textboxes on it (txtValue1a,txtValue1b,txtValue2a,txtValue2b). Two of them
are visuable based on the selected option.

Anyone have any ideas on where to begin looking?

The binding logic looks like:

public sub Init(byValue objClass as TestClass)

dim b as binding

'Bind to the options selection control
b=new binding("SelectedOption",objTestClass,"SelectedOpt ion")
me.control11.databindings.add(b)

'Notify the second control of changes in options
me.control11.control2 = me.control21

'Bind to the values control
'This is the property used for optionA
b=new binding("Text",objTestClass,"Value1A")
me.control21.txtValue1a.databindings.add(b)
b=new binding("Text",objTestClass,"Value1B")
me.control21.txtValue1b.databindings.add(b)

'This is the property used for optionB
b=new binding("Text",objTestClass,"Value2A")
me.control21.txtValue2a.databindings.add(b)
b=new binding("Text",objTestClass,"Value2B")
me.control21.txtValue2b.databindings.add(b)

end sub
Jan 23 '06 #1
0 1180

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

Similar topics

1
by: | last post by:
Hi, I posted a message a while ago about programatically databinding and got a response that did not make sense to me. Here's a brief description of what I want to do. If I create a regular...
6
by: John Bailey | last post by:
I have a web page with a formview, and a multiview in the formview. When I databind the values inside the multiview views, there is no option for two-way databinding. The form populates fine, but...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
8
by: Joey Chömpff | last post by:
L.S., Hello is there a way to implement 2-way databinding without using the datasources from dotnet 2.0. Why would you ask? Now that's simple. I've created an object model with BusinessObjects...
1
by: Owen Blacker | last post by:
I've spent loads of time Googling to try to work this one out and I'm sure it's something obvious. I get an InvalidOperationException reading "Databinding methods such as Eval(), XPath(), and...
1
by: esakal | last post by:
Hello, I have a very strange problem which involve databinding in winform c#.net 2 . I have a user control which holds textbox inside. the user control has property which reflect the...
4
by: moondaddy | last post by:
I'm trying to databind a dependency property in a custom control (CenterX) to the Line.X1Property property of line. If I can correctly do this (and the same for the 'Y' props) then when I drag my...
1
by: Mark Olbert | last post by:
Has anyone else noticed that the design-time support for databinding in custom controls in ASPNET2 sucks? At least for GridViews? So far I've spent going on two days trying to get the following...
3
by: Peter | last post by:
Hi! I am having some very strange behavior with my databound controls. It's taken a long time to isolate exactly what is provoking the problem, but I'm still leagues away from solving it. I...
2
by: =?Utf-8?B?QnJpYW4gTmljaG9sc29u?= | last post by:
Hello -- I'm having problems figuring out how to bind an XML file to a treeview control. I have the following test XML: <?xml version="1.0" encoding="utf-8"?> <instruments> <instrument...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.