I've only just stared using VS2008 VB so please excuse me if this seems a very basic question. (I've amended my example to the Northwind Database to avoid any confusion)
WHAT I HAVE
I have a dataset called KeyData made up of two tables Customers and Orders.
I have two forms, one named MainForm that shows records from Customers in details view and the related Orders shown in GridView called OrdersDataGridView. The other form is called OrdersForm and is populated with the Orders table from the keydata dataset and shows records in details view.
When I navigate the MainForm customer records the correct orders are shown in the OrdersDataGridView. So far so good.
Here's the code that was generated when I dropped the tables within KeyData dataset onto the MainForm:
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'KeyData.Orders' table. You can move, or remove it, as needed. Me.OrdersTableAdapter.Fill(Me.KeyData.Orders) 'TODO: This line of code loads data into the 'KeyData.Customers' table. You can move, or remove it, as needed. Me.CustomersTableAdapter.Fill(Me.KeyData.Customers) End Sub
WHAT I WANT.
On clicking a recorded (or row) in OrdersDataGridView I want to open the second from (OrdersForm) and only show derails (in the OrdersForm) of the specific row that was clicked on the OrdersDataGridView. I'm sure everyone knows the related field in Orders in OrdersID
As I'll be opening the OrdersForm as a modal I don't need to close the MainForm.
Also, I’ll be using this method of showing details in various other parts my project. In some case I’ll want to show records that can be edited, in other cases I want the records to be read only and in one instance I’ll want to show a new record ready for data entry. In this case I want them to be read only, but it would be nice to know how I could change this on opening the form.
Sorry to be so long winded in the explanation but I wanted to be as clear as my knowledge allows.
Thank you in advance
PS For thos who surf the forums I did post this elsewhere but haven't got much help so far.