473,772 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bound Grids Not Working Correctly

I'm having trouble trying to get some bound datagrids to work. I even tried
to use some examples that were given to me, but I can't get those to work,
either.

I have customers, who have orders, which have order details. The order
details also use a product lookup table, to get description, etc., and this
seems to be the problem table. Customer -> Order is a 1:m relationship, Order
-> OrderDetails is a 1:m relationship, but the OrderDetails -> Product is a
m:1 relationship.

Here is my code that I'm using (It goes into the Form_Load event). The first
3 grids populate and work well together, as I navigate through them. The 4th
grid is blank, and stays that way. Flex1,2,3,4 are Flexgrids from Component1,
but they work the same with Microsoft's grids, too.

Can anybody tell me what I'm doing wrong, and how to make it work properly?
Thanks in advance.

Dim drc As DataRowCollecti on
Dim dcc As DataColumnColle ction
Dim ds As DataSet = New DataSet("Hierar chical Dataset")
ds.Tables.Add(" Products")
dcc = ds.Tables("Prod ucts").Columns
dcc.Add("ID", GetType(String) )
dcc.Add("Name", GetType(String) )
dcc.Add("Value" , GetType(Decimal ))
drc = ds.Tables("Prod ucts").Rows
drc.Add(New Object() {"P1", "Widget", 19.95})
drc.Add(New Object() {"P2", "Gadget", 22.75})
drc.Add(New Object() {"P3", "Sprocket", 33.1})
ds.Tables.Add(" Customers")
dcc = ds.Tables("Cust omers").Columns
dcc.Add("ID", GetType(String) )
dcc.Add("Name", GetType(String) )
dcc.Add("Addres s", GetType(String) )
drc = ds.Tables("Cust omers").Rows
drc.Add(New Object() {"C1", "John", "122 Penny Lane"})
drc.Add(New Object() {"C2", "Paul", "646 Abbey Road"})
drc.Add(New Object() {"C3", "George", "222 Chatham Road"})
drc.Add(New Object() {"C4", "Ringo", "345 Oxford St"})
ds.Tables.Add(" Orders")
dcc = ds.Tables("Orde rs").Columns
dcc.Add("ID", GetType(String) )
dcc.Add("Custom erID", GetType(String) )
dcc.Add("Prty", GetType(Integer ))
dcc.Add("Date", GetType(DateTim e))
drc = ds.Tables("Orde rs").Rows
drc.Add(New Object() {"O1", "C1", 1, "12/1/01"})
drc.Add(New Object() {"O2", "C2", 2, "1/22/02"})
drc.Add(New Object() {"O3", "C3", 3, "1/20/02"})
drc.Add(New Object() {"O4", "C4", 1, "1/14/02"})
drc.Add(New Object() {"O5", "C1", 3, "1/16/02"})
ds.Tables.Add(" OrderDetail")
dcc = ds.Tables("Orde rDetail").Colum ns
dcc.Add("ID", GetType(String) )
dcc.Add("OrderI D", GetType(String) )
dcc.Add("Produc tID", GetType(String) )
dcc.Add("Qty", GetType(Integer ))
drc = ds.Tables("Orde rDetail").Rows
drc.Add(New Object() {"D1", "O1", "P1", 1})
drc.Add(New Object() {"D2", "O1", "P2", 12})
drc.Add(New Object() {"D3", "O1", "P3", 1})
drc.Add(New Object() {"D4", "O2", "P1", 1})
drc.Add(New Object() {"D5", "O2", "P2", 8})
drc.Add(New Object() {"D6", "O2", "P3", 1})
drc.Add(New Object() {"D7", "O3", "P1", 1})
drc.Add(New Object() {"D8", "O4", "P1", 1})
drc.Add(New Object() {"D9", "O4", "P2", 10})
drc.Add(New Object() {"D10", "O5", "P1", 1})
drc.Add(New Object() {"D11", "O5", "P2", 16})
drc.Add(New Object() {"D12", "O5", "P3", 1})
ds.Relations.Ad d("CustomerOrde rs",
ds.Tables("Cust omers").Columns ("ID"),
ds.Tables("Orde rs").Columns("C ustomerID"))
ds.Relations.Ad d("Order Details", ds.Tables("Orde rs").Columns("I D"),
ds.Tables("Orde rDetail").Colum ns("OrderID"))
ds.Relations.Ad d("Product Details",
ds.Tables("Prod ucts").Columns( "ID"),
ds.Tables("Orde rDetail").Colum ns("ProductID") )

flex1.DataMembe r = "Customers"
flex1.DataSourc e = ds
flex2.DataMembe r = "Customers.Cust omerOrders"
flex2.DataSourc e = ds
flex3.SetDataBi nding(ds, "Customers.Cust omerOrders.Orde r Details")
flex3.DataSourc e = ds
Flex4.SetDataBi nding(ds, "Customers.Cust omerOrders.Orde r
Details.Product Details")
Flex4.DataSourc e = ds

Feb 28 '06 #1
0 1238

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

Similar topics

2
3453
by: Phil | last post by:
My form uses a dataset containing two tables, a base table (Contact) and a lookup table (Insurer). My combobox is bound as follows: DataSource = datasetContact DisplayMember = Insurer.InsurerName ValueMember = Insurer.InsurerId DataBindings.SelectedValue = Contact.InsurerId It generally works fine. I am able to navigate records and
19
4108
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
2
7765
by: Ed via AccessMonster.com | last post by:
Hi all, What I am trying to do is get the value of the second column of a bound combo box in vba. example: Combo box: column 1-ID column 2-SIGN_CODE 1 R-1.gif 2 R-2.gif
0
2346
by: Lyn | last post by:
I am having a frustrating time trying to do a simple insert of a BMP picture into a Bound Object Frame using both VBA and the Insert | Object... dialog. I had a separate post thread going on this and closed it off when I thought I had resolved the problem, but now I am back at square one. So I thought I would start afresh with a new post. Here is the problem... A few months ago, I set up a Bound Object Frame on a form which was tied to...
2
1506
by: orekinbck | last post by:
Hi There Using C# forms, I have a main screen that contains 2 data grids. * The data grids are connected to ArrayLists (each grid has its own ArrayList) * The data grids are intended for display purposes only * When the user clicks on a cell I want the whole row to select * The user can only select one row at a time * I want to wire up the two data grids so that changing the selected row in one data grid changes the selected row in the...
3
1794
by: Matthew Woods | last post by:
Hi, is there any way to format and order the columns displayed in a datagrid bound to a class that inherits from IBindingList? i have used DataGridTableStyle and added DataGridTextBoxColumns to it in the correct order which works fine if the dataGrid.dataSource = "ArrayList", but it doesn't work for my IBindingList wrapper. If i bind the datasource to the arraylist method then the ListChangedEventHandler is never invoked and my grid only...
4
4620
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box bound to a table as a lookup, drawing values from another table to populate the available selections. This all worked fine in VB6. I have distilled the problem down to a simple form drawing data from the Northwind database for a representative...
0
1382
by: Jeff Morgan | last post by:
I have an application that runs on ASP.NET. We have been working through performance testing and it appears that at about 40-50 users, I start to get CPU bound. The application is a three form, ASP.NET 2.0 application. A login page, and a main page, that is a frame with a header page, and the main page. On the main page, there are two datagrids that pull data from a database. The problem is that on one of the grids, the amount of rows...
9
1740
by: Ben | last post by:
General question for the group. I have a friend who claims that PHP/Java grids can't touch .NET with respect to dev time, reliability and speed. I'm not in a position to debate but would like to know the thoughts given the following requirements: - Grid will handle 1,000 row, 25 columns record sets on a regular basis - Multiple users hitting same data set so automatic refreshes will need to occur frequently, 10 second intervals for...
0
9454
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
10264
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
10106
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
10039
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
9914
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
8937
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
7461
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
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4009
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

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.