loading a file on the lisview conttrol by a double click (c#)
-
I did this! private void lvFiles_SelectedIndexChanged(object sender, System.EventArgs e) { string filePath = lvFiles.SelectedItems.ToString(); ShellLib.ShellExecute shellExecute = new ShellLib.ShellExecute(); shellExecute.Verb = ShellLib.ShellExecute.OpenFile; shellExecute.Path = @"F:\\Painel de Controle ETECH\\Projetos ETECH" + filePath; shellExecute.Execute(); } Am I close??
-
I did this! private void lvFiles_SelectedIndexChanged(object sender, System.EventArgs e) { string filePath = lvFiles.SelectedItems.ToString(); ShellLib.ShellExecute shellExecute = new ShellLib.ShellExecute(); shellExecute.Verb = ShellLib.ShellExecute.OpenFile; shellExecute.Path = @"F:\\Painel de Controle ETECH\\Projetos ETECH" + filePath; shellExecute.Execute(); } Am I close??
the event you're using will fire as you move down the list via keyboard or do single click selections. There should be a double click event. use that instead.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots. -- Robert Royall
-
I did this! private void lvFiles_SelectedIndexChanged(object sender, System.EventArgs e) { string filePath = lvFiles.SelectedItems.ToString(); ShellLib.ShellExecute shellExecute = new ShellLib.ShellExecute(); shellExecute.Verb = ShellLib.ShellExecute.OpenFile; shellExecute.Path = @"F:\\Painel de Controle ETECH\\Projetos ETECH" + filePath; shellExecute.Execute(); } Am I close??
Also your shellExecute.Verb should be "open". List of Verbs - http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx[^]
Just because we can; does not mean we should.