PC Review


Reply
Thread Tools Rate Thread

Datagrid Relation View

 
 
WStoreyII
Guest
Posts: n/a
 
      6th Apr 2004
I wish to make a custom view of relations in a datagrid
what i want to do is when the plus sign is clicked instead of showing the
link label
i want to show a grid with the subtable in that area between the selected
grid and the next grid.

however i cannot seem to find a method of obtaing the position coordinate
for that area.? and ideas on how to go about finding the position?

WStoreyII

thanks again


 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      6th Apr 2004
Hi,


Here is an example that uses the northwind database. Add 3
datagrids to a form. dgorders, dgorderdetails, dgemployees.


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim ds As DataSet

Dim daEmployees As SqlDataAdapter

Dim daOrders As SqlDataAdapter

Dim daOrderDetails As SqlDataAdapter

Dim conn As SqlConnection

Dim strConn As String

Dim strSQL As String

Dim strItem As String

Dim ctrl As Control

For Each ctrl In Me.Controls

If TypeOf ctrl Is DataGrid Then

Dim dg As DataGrid = ctrl

dg.AllowNavigation = False

End If

Next

strConn = "Server = " + Environment.MachineName + "\VSdotNet;"

strConn += "Database = NorthWind;"

strConn += "Integrated Security = SSPI;"

conn = New SqlConnection(strConn)

ds = New DataSet

daEmployees = New SqlDataAdapter("Select * from Employees", conn)

daOrders = New SqlDataAdapter("Select * from Orders", conn)

daOrderDetails = New SqlDataAdapter("Select * from [Order Details]", conn)

daEmployees.Fill(ds, "Employee")

daOrders.Fill(ds, "Orders")

daOrderDetails.Fill(ds, "OrderDetails")

ds.Relations.Add("EmployeeOrder",
ds.Tables("Employee").Columns("EmployeeID"), _

ds.Tables("Orders").Columns("EmployeeID"))

ds.Relations.Add("Order2Details", ds.Tables("Orders").Columns("OrderID"), _

ds.Tables("OrderDetails").Columns("OrderID"))

dgEmployees.SetDataBinding(ds, "Employee")

dgOrders.SetDataBinding(ds, "Employee.EmployeeOrder")

dgOrderDetails.SetDataBinding(ds, "Employee.EmployeeOrder.Order2Details")

End Sub





Ken

--------------------

"WStoreyII" <(E-Mail Removed)> wrote in message
news:45Dcc.19055$(E-Mail Removed)...
> I wish to make a custom view of relations in a datagrid
> what i want to do is when the plus sign is clicked instead of showing the
> link label
> i want to show a grid with the subtable in that area between the selected
> grid and the next grid.
>
> however i cannot seem to find a method of obtaing the position coordinate
> for that area.? and ideas on how to go about finding the position?
>
> WStoreyII
>
> thanks again
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid and relation between two table. archana Microsoft C# .NET 1 5th Feb 2007 11:43 AM
relation 1:m in two datagrid, don't nested Vlada Milicevic Microsoft ADO .NET 1 4th Aug 2005 02:45 PM
Many-to-many relation in a datagrid... Jan Nielsen Microsoft VB .NET 4 16th Dec 2004 10:47 AM
Many-to-many relation in a datagrid... Jan Nielsen Microsoft ADO .NET 4 16th Dec 2004 10:47 AM
Datagrid with relation problem Steve martin Microsoft Dot NET Framework Forms 2 11th Aug 2003 09:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:06 AM.