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

    how to load the data from datagridview into windows forms accordingly

    i want that when i click on any record the date of that record will be loaded in forms above
    help me please

    i am using CellMouseClick event but in the form it show System.Windows.Forms.DataGridViewSelectedRowCollection instead of showing data

    i am using this function

    private void Customers_view_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
    {
    ContactLastName.Text = Customers_view.SelectedRows.ToString();
    }

    plz see image here
    Name:  post-607972-13518618300075.png
Views: 452
Size:  45.8 KB

  2. #2
    Join Date
    Oct 2004
    Location
    Rocket City
    Posts
    220

    Re: how to load the data from datagridview into windows forms accordingly

    I have not used the DataGridViewSelectedRowCollection, but here is an idea of the tasks you need to perform:
    1. Select one DataGridViewRow from the DataGridViewSelectedRowCollection. From clicking one cell this would most likely be the first item in the collection.
    2. Select one Cell from the DataGridViewRow. You want to use the column index of the column containing the date you stored.
    3. Then you can get the ToString() of that cell.

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