473,756 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Complicated Data Binding Question

me
I've included a picture below to show what I am trying to accomplish.
It is best to copy/paste into notepad to get the spacing correct.

I have a dataset that contains 3 tables. Two of the tables contain
data and the third links them together. The dataset has a constraint
setup as well.

The first listbox and the first and last name text box are bound to
the Person DataTable. As you select a name in the listbox, the
textbox will be updated with the appropriate name. You can make
modifications to the name and have them updated in the listbox.

This works just fine. Now for the problem.

I need to have the second listbox populated with entries that are
specific to the person that is selected in the first listbox. This
restriction prevents me from directly binding to the Address
DataTable. Once I have the filtered data , I will then need to have
the same editing capabilities as listed above.

Ideally, I would like to do databinding as I will be writing the
values back into the database. I'm just not sure how to filter and
bind at the same time.

If you have a code example somewhere or just a basic "here's what you
need to do" list or any thoughts on how to accomplish this, I would
love to hear about it.

Thanks,
Dave
+--------------+ +--------------+ +--------------+
| Person | | Person2Addr | | Address |
+--+-----------+ +--+-----------+ +--+-----------+
|PK| ID |>---|PK| PersonID |---<|PK| ID |
| | LastName | |PK| AddressID | | | City |
| | FirstName | +--+-----------+ | | State |
+--+-----------+ +--+-----------+

+-----------------------------------------------------------+
| +------------+ +------------+------------------------+ |
| | Listbox | | First Name:| Jane | |
| +------------+ +------------+------------------------+ |
| | Smith,Jane | | Last Name: | Smith | |
| | Smith,John | +------------+------------------------+ |
| +------------+ |
| |
| +--------------+ +--------+----------------------------+ |
| | Listbox | | City: | St. Louis | |
| +--------------+ +--------+----------------------------+ |
| | St.Louis, MO | | State: | MO | |
| | Raleigh, NC | +--------+----------------------------+ |
| +--------------+ |
+-----------------------------------------------------------+

Jul 22 '05 #1
3 1611
Me,

You can in my opinion use two approaches (I only declare the second)
You can set a relation, however the most simple one in my opinion is to set
in the index change event the datasource of your second listbox to a
defaultview (dataview) with a rowfilter.

Be aware that you have to protect that event at loading time from taking
action.

Altough, if I understand your well, than I would take a datagrid and not a
listbox for the second. From that datagrid you can using the defaultview
(dataview) remove a lot of editing possibilities and you can remove as well
as the so called left header. With what the datagrid becomes a kind of
multicolumn editable listbox.

I hope this gives an idea, otherwise reply?

Cor
Jul 22 '05 #2
I don't see how using a datafilter will get me there.

If "Jane Smith" has 20 addresses in the address table, there would be
20 entries in the person2addr table as well.

I would have to lookup in the person2addr table for all the AddressIDs
that match the ID of "Jane Smith". From there I would have to create
the filter using the 20 AddressIDs that were returned. I'm not sure
that is feasible.

If I am missing something please let me know.

Thanks,
Dave

On Sun, 3 Jul 2005 10:54:45 +0200, "Cor Ligthert"
<no************ @planet.nl> wrote:
Me,

You can in my opinion use two approaches (I only declare the second)
You can set a relation, however the most simple one in my opinion is to set
in the index change event the datasource of your second listbox to a
defaultview (dataview) with a rowfilter.

Be aware that you have to protect that event at loading time from taking
action.

Altough, if I understand your well, than I would take a datagrid and not a
listbox for the second. From that datagrid you can using the defaultview
(dataview) remove a lot of editing possibilities and you can remove as well
as the so called left header. With what the datagrid becomes a kind of
multicolumn editable listbox.

I hope this gives an idea, otherwise reply?

Cor


Jul 22 '05 #3
Dave,
If "Jane Smith" has 20 addresses in the address table, there would be
20 entries in the person2addr table as well.


From your first message I did not understand that you not are using a
primary key. If that is the fact, how do you than want to handle that
problem as you describe above?

Cor
Jul 22 '05 #4

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

Similar topics

1
281
by: Marcin Floryan | last post by:
Hello! My question regards opening (and re-opening) Form and the Load event. I have a main form (frmMain) and I also have a data form (frmData). In the main form I have created: Private fData as new frmData()
0
2348
by: Ann Morris | last post by:
INTRODUCTION One of the most powerful aspects of .NET and Windows Forms is data binding. Data binding is the process of associating user interface (UI) elements with a data source to generate a visual representation of data. Two types of data binding are available for Windows Forms: Simple Data Binding and Complex Data Binding. Simple data binding allows you to bind one data element to a control. In many situations you want to display...
1
2600
by: matty.hall | last post by:
There's a lot of information out there about data-binding UI objects (i.e. derived from Control) to non-UI custom business objects. Is it possible to do the same without any UI being involved at all? Here's an example: I want to do data binding on some of the properties of a TreeNode (namely its Name). Unfortunately, TreeNode does not derive from Control, so it doesn't have the "stock" data binding stuff. I'd like to create a new...
0
1732
by: popsovy | last post by:
Hi I have a question about whether Data Binding can facilitate the process of saving data in a web application I learned that you can data bind information from a number of different data sources to controls such as TextBox, ListBox, etc. I am clear on the concept of data flowing from data sources into web forms controls What I am not clear about is how to make the data flow the other way. When I am ready to save the changes or add a...
10
1924
by: Fares Eidi | last post by:
I am a VB6 intermediate programmer just starting out using VB.net and would like to ask what I'd be missing out on if I just use time saving techniques like data binding, data adapter wizards etc to create my front end application. Building the data access forms using manual coding just seems like a lot of work.... Any guidance would be appreciated Fares
2
4912
by: Matthias | last post by:
Hi Team this may be a newbie question. I have searched the discussions before posting: I'd like to re-use a form instance to edit record details. My data binding (a DataTable bound to TextBoxes) works fine the first time round. I can see, edit and update the details from my form, then close the form. I then like to select and refill the datatable with a different record (new
3
287
by: me | last post by:
I've included a picture below to show what I am trying to accomplish. It is best to copy/paste into notepad to get the spacing correct. I have a dataset that contains 3 tables. Two of the tables contain data and the third links them together. The dataset has a constraint setup as well. The first listbox and the first and last name text box are bound to the Person DataTable. As you select a name in the listbox, the textbox will be...
19
2227
by: Larry Lard | last post by:
In the old days (VB3 era), there was a thing called the Data Control, and you could use it to databind controls on forms to datasources, and so (as the marketing speak goes), 'create database applications without writing a single line of code!!!'. Personally, and I know I wasn't alone in this, I was always suspicious of this claim, because one invariably ended up writing huge amounts of code attempting to get the automagical thing to do...
14
14656
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control so I get the ObjectDataSource. No problem ..... ObjectDataSource src = .... //is ok i have it
0
9455
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9271
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9869
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
9838
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
9708
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8709
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...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.