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

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 DataRowCollection
Dim dcc As DataColumnCollection
Dim ds As DataSet = New DataSet("Hierarchical Dataset")
ds.Tables.Add("Products")
dcc = ds.Tables("Products").Columns
dcc.Add("ID", GetType(String))
dcc.Add("Name", GetType(String))
dcc.Add("Value", GetType(Decimal))
drc = ds.Tables("Products").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("Customers").Columns
dcc.Add("ID", GetType(String))
dcc.Add("Name", GetType(String))
dcc.Add("Address", GetType(String))
drc = ds.Tables("Customers").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("Orders").Columns
dcc.Add("ID", GetType(String))
dcc.Add("CustomerID", GetType(String))
dcc.Add("Prty", GetType(Integer))
dcc.Add("Date", GetType(DateTime))
drc = ds.Tables("Orders").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("OrderDetail").Columns
dcc.Add("ID", GetType(String))
dcc.Add("OrderID", GetType(String))
dcc.Add("ProductID", GetType(String))
dcc.Add("Qty", GetType(Integer))
drc = ds.Tables("OrderDetail").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.Add("CustomerOrders",
ds.Tables("Customers").Columns("ID"),
ds.Tables("Orders").Columns("CustomerID"))
ds.Relations.Add("Order Details", ds.Tables("Orders").Columns("ID"),
ds.Tables("OrderDetail").Columns("OrderID"))
ds.Relations.Add("Product Details",
ds.Tables("Products").Columns("ID"),
ds.Tables("OrderDetail").Columns("ProductID"))

flex1.DataMember = "Customers"
flex1.DataSource = ds
flex2.DataMember = "Customers.CustomerOrders"
flex2.DataSource = ds
flex3.SetDataBinding(ds, "Customers.CustomerOrders.Order Details")
flex3.DataSource = ds
Flex4.SetDataBinding(ds, "Customers.CustomerOrders.Order
Details.Product Details")
Flex4.DataSource = ds

Feb 28 '06 #1
0 1219

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

Similar topics

2
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 =...
19
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...
2
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 ...
0
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...
2
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...
3
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...
4
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...
0
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,...
9
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?

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.