Results 1 to 2 of 2

Thread: find the contents of a cell in a datagrid row [*Resolved*]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    find the contents of a cell in a datagrid row [*Resolved*]

    Hello,

    I have a datagrid with a list of customers. I want to be able to click on the row then be able to display the customer number which is in the first column of that row.

    I have code for finding the row number:
    Code:
     rowNumber = grdDisplayCustomers.CurrentRowIndex;
    But how do find out the customer number which is in the first column of that row.

    Many thanks in advance,

    Steve
    Last edited by steve_rm; Oct 23rd, 2004 at 02:04 AM.
    steve

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Try this
    Code:
    int rowId = dataGrid1.CurrentRowIndex;
    DataRow row = ds.Tables[0].Rows[rowId];
    MessageBox.Show(row["CustomerID"].ToString());

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