473,785 Members | 2,612 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,txt Value1b,txtValu e2a,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("Select edOption",objTe stClass,"Select edOption")
me.control11.da tabindings.add( b)

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

'Bind to the values control
'This is the property used for optionA
b=new binding("Text", objTestClass,"V alue1A")
me.control21.tx tValue1a.databi ndings.add(b)
b=new binding("Text", objTestClass,"V alue1B")
me.control21.tx tValue1b.databi ndings.add(b)

'This is the property used for optionB
b=new binding("Text", objTestClass,"V alue2A")
me.control21.tx tValue2a.databi ndings.add(b)
b=new binding("Text", objTestClass,"V alue2B")
me.control21.tx tValue2b.databi ndings.add(b)

end sub
Jan 23 '06 #1
0 1197

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

Similar topics

1
1409
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 aspx page I can use the designer to create a DataAdapter and generate a typed dataset. I can then put a datalist on my page, set its datasourse property to my dataset and put a Textbox inside the
6
3574
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 when it calls the update method, it calls it with no parameters. Is there just no support for two-way databinding inside these controls, or is there a technique I am missing?
8
2186
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 answered... In 1.1 we always did our own myDataAdapter.fills and we liked that control for lots of good reasons. Now the new DataSource (or is it a TableAdapter:Dataset) automatically fills the Gridview. How can we control that fill? In a...
8
1833
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 and I don't want to write an separate provider layer for the datasources. This is because I loose all the benefits of my objectmodel. Are there other developers who think this way?
1
16261
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 Bind() can only be used in the context of a databound control" when I start my page. Unless I'm missing something obvious, this is *not* the same issue as the "2-way databinding cascading lists" issue in...
1
2425
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 inner textbox text
4
2627
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 custom control the line should follow it (stay connected) I know the dependency props in my custom control work OK because all works OK when I do this in xaml, but when I try to set it up at run time via c# in the codebehind, the line does not...
1
1747
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 simple statements to actually generate something at design-time: gridView = new GridView(); gridView.AutoGenerateColumns = true; gridView.DataSource = ; gridView.DataBind(); I have tried everything I could think of, or read about in four books...
3
1887
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 have a DataView which filters a DataSet. Bound to this dataview is a ListBox, via its DataSource property. The DisplayMember is the name property of the row. Simple enough so far?
2
2073
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 name="Name1" type="Type1" path="Path1" /> <instrument name="Name2" type="Type2" path="Path2" /> <instrument name="Name3" type="Type3" path="Path3" /> </instruments>
0
10336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8978
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.