Results 1 to 4 of 4

Thread: datagrid selected row values

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    83

    datagrid selected row values

    How to retrieve data from the selected row in datgrid. It is a single selection. So only one row will be selected

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: datagrid selected row values

    Is this grid bound to a DataTable by chance?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    83

    Re: datagrid selected row values

    Sorry for not replying sooner.

    Well, I was using Visual Studio 2005, and then happened to use 2003 later. Thats where I got stuck....since CurrentCell is not available in it.

    Anyway, I will not be using 2003 anymore, but it would be useful...to know how to retrieve a row's values using VS 2003. . That is without using CurrentCell.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: datagrid selected row values

    If you're not using 2003 any more then it can't be useful to know, but maybe interesting. You use the CurrentRowIndex to get a DataRowView from the DefaultView of the bound DataTable, e.g.
    VB.NET Code:
    1. Dim row As DataRowView = myDataTable.DefaultView(myGrid.CurrentRowIndex)
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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