开发者

double click on datagrid view to open email messages

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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜