[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 223
  • Last Modified:

Retrieving contents of dataviewgrid

I have a C# 2005 application using a dataviewgrid object.  It is bound to a dataset generated through the datasource wizard of the control.  I would like to have access to the content of the cells in the grid. I have used the CellClick event and use the RowIndex and ColumnIndex Values but am having difficulty getting the cell content value.  Can anyone help me with this?
Thanks daforga
0
daforga
Asked:
daforga
1 Solution
 
e1vCommented:

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string value = dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString();
            string formattedValue = dataGridView1[e.ColumnIndex, e.RowIndex].FormattedValue.ToString();
            MessageBox.Show("Value = " + value +Environment.NewLine+ "Formatted value = "+formattedValue);
        }

I'm not sure I understood your problem, does this answer it?
0
 
daforgaAuthor Commented:
Thank you.  Just what I wanted.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now