Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Displaying selected data in a detail form.
 

Displaying selected data in a detail form.

Hi, really hoping someone can help me out on this.

I have an application with 2 forms. The first form ( forma ) contains a datagridview which lists existing customers in my database. The datagridview is linked to a binding source etc etc and everything is displayed correctly. When I click the view customer details button it opens up another form which I want to display the details of the customer which was selected from the datagridview on the previous form. How do I go about linking the 2nd form to the selected customer?

I am using visual basic .net 2005 Express Edition.

Any help with this would be greatly appreciated.

 

m.eisenstein  Wednesday, January 24, 2007 3:21 PM
Read this.
vkh75  Wednesday, January 24, 2007 3:36 PM

 Private Sub ViewOrders(ByVal customerId As String)

        ' Show the CustomerOrders dialog, passing in the

        ' customer ID.

        Dim co As CustomerOrdersForm = New CustomerOrdersForm

 

        co.ShowDialog(customerId, Me, northwindDS)

End Sub

 

    Private Sub dataGridView1_CellContentClick(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles dataGridView1.CellContentClick

        ' Show the customer order screen when the user clicks the link.

        If e.ColumnIndex = 1 AndAlso Not dataGridView1.Rows(e.RowIndex).IsNewRow Then

 

            Dim customerID As String = TryCast(dataGridView1.Rows(e.RowIndex).Cells("CustomerID").Value, String)

            If Not (customerID Is Nothing) Then

                Me.ViewOrders(customerID)

            End If

        End If

End Sub

 

 

 

beside this ,this is a example named as datagridview overview which maybe can help you

Gavin Jin - MSFT  Thursday, January 25, 2007 1:16 AM

You can use google to search for other answers

Custom Search

More Threads

• databinding a textbox to a datasource
• Please help with changing contents of database with VB2005
• deleting row in datagridview using foreach
• Force non-list property to show in DataMember list
• DataGridView - Sort column after DataSource binding.
• DataGrid Formatting when bound to ArrayList?
• Datagridview.Beginedit()
• Search Form and Detail form
• controlling optimistic concurrency behaviour by code
• Listbox Databinding problem