Link to home
Start Free TrialLog in
Avatar of ukerandi
ukerandiFlag for United Kingdom of Great Britain and Northern Ireland

asked on

C# - Winform

Hi See below my code
  private void dataGridViewFranceCube_CellContentClick(object sender, DataGridViewCellEventArgs e)
            {
                DataGridViewRow rowNumber = dataGridViewFranceCube.SelectedRows[0];
                txtitem.Text = rowNumber.Cells[0].Value.ToString();
                txtProductDescription.Text = rowNumber.Cells[2].Value.ToString();
            }

Open in new window


Sometime this is not working, any idea where im doing mistake, What i need is ,when user click i need to get row data for example
if user click on row 2 i need column1 and column 2 data.
ASKER CERTIFIED SOLUTION
Avatar of Naitik Gamit
Naitik Gamit
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ukerandi

ASKER

private void dataGridViewFranceCube_CellClick(object sender,  DataGridViewCellEventArgs e)
            {
                MessageBox.Show("Test");

           

                DataGridViewImageCell cell = (DataGridViewImageCell)
                    dataGridViewFranceCube.Rows[e.RowIndex].Cells[e.ColumnIndex];

               

             
            }


and also i have add following code to Designer.cs also but still not working

   this.dataGridViewFranceCube_CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridViewFranceCube_CellClick);
Hi,
do you have any exception thrown ? if yes can you show it ?