views:

308

answers:

2

this is for winforms using c# I have a datagridview which lists the email messages (.msg) in a folder.

my aim: if user double clicks on a cell in the datagridview, the corresponding email message must be opened for view

how do I do this?

+1  A: 

You will be storing the path of the msg file some where right? Then you can use the CellDoubleClick or the CellMouseDoubleClick event to open the msg file using Process.Start. I assume outlook is installed and MSG file is associated with outlook. Hope this gives enough information write you own code.

Shoban
thanks, it worked
balalakshmi
Glad you solved it ;-)
Shoban
BTW start accepting some answers(?)
Shoban
A: 

You need to find out which row is selected first, then obtain the cell where it is actually selected and intercept the datagridview mouse event handler (doubleclick) to trigger the load of the message. As an example
private void dataGridView1_DoubleClick(object sender, EventArgs e)
{
 // Check if the selected cell count is 1 only
  if (this.dataGridView1.SelectedCells.Count == 1)
  {
   DataGridViewSelectedCellCollection col = this.dataGridView1.SelectedCells;
   // Example: The column of a selected row contains the value Msg
   if (col[0].Value == "Msg")
    {
     // Trigger the load mechanism
    }
  }
}

Hope this gives you the right direction, Best regards, Tom.

tommieb75