CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Datagridviews

  1. #1
    Join Date
    Feb 2009
    Posts
    192

    Datagridviews

    Hi,

    I have a datagridview (DgvProductDet) it has 5 columns (data bounded)

    TruckModel
    ProductName
    Quantity
    Priceperitem
    Buy Now (Button Click)


    I have another dagaridview (DgvSelectedItems) it has 4 columns (data unbounded)

    TruckModel
    ProductName
    Quantity
    Priceperitem


    What I want to achieve is that when the Buy Now (Button Click) which is at the end of each row is clicked, the details of that row are populated on the other datagridview (DgvSelectedItems)..

    How can I achieve this please?

    Thanks

  2. #2
    Join Date
    Sep 2012
    Posts
    6

    Re: Datagridviews

    Hi,
    this is my first post here, so check this twice
    Code:
    Private Sub DgvProductDet_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DgvProductDet.CellClick
            If e.ColumnIndex = 4 Then
                Dim param(3) As Object
                For i As Integer = 0 To 3
                    param(i) = DgvProductDet.Rows(e.RowIndex).Cells(i).Value
                Next
                DgvSelectedItems.Rows.Add(param)
            End If
    
        End Sub
    I hope this is what you want.

    Regards
    benek

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured