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

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 1581
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
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...
0
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...
1
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...
0
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...
10
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...
2
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...
3
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...
19
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...
14
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...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
0
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,...
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...

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.