Série de button, un seul fonctionne
Bonjour à tous,
Je suis nouveau dans le C# :oops:
J'essaie de faire un petit logiciel pour accelerer quelques procédures dans mon travail.
J'ai une série de boutons, qui ouvre tel ou tel fichier txt.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void PREP_PGD_Click(object sender, EventArgs e)
{
var psi1 = new ProcessStartInfo();
psi1.FileName = "notepad.exe";
psi1.Arguments = @"C:\nam\PREP_PGD.nam";
psi1.Verb = "runas";
var process = new Process();
process.StartInfo = psi1;
process.Start();
process.WaitForExit();
}
private void PREP_NEST_PGD_Click(object sender, EventArgs e)
{
var psi2 = new ProcessStartInfo();
psi2.FileName = "notepad.exe";
psi2.Arguments = @"C:\nam\PREP_NEST_PGD.nam";
psi2.Verb = "runas";
var process = new Process();
process.StartInfo = psi2;
process.Start();
process.WaitForExit();
}
private void PREP_REAL_CASE_Click(object sender, EventArgs e)
{
var psi3 = new ProcessStartInfo();
psi3.FileName = "notepad.exe";
psi3.Arguments = @"C:\nam\PREP_REAL_CASE.nam";
psi3.Verb = "runas";
var process = new Process();
process.StartInfo = psi3;
process.Start();
process.WaitForExit();
}
private void SPAWNING_Click(object sender, EventArgs e)
{
var psi4 = new ProcessStartInfo();
psi4.FileName = "notepad.exe";
psi4.Arguments = @"C:\nam\SPAWN1.nam";
psi4.Verb = "runas";
var process = new Process();
process.StartInfo = psi4;
process.Start();
process.WaitForExit();
}
private void EXSEG1_Click(object sender, EventArgs e)
{
var psi5 = new ProcessStartInfo();
psi5.FileName = "notepad.exe";
psi5.Arguments = @"C:\nam\EXSEG1.nam";
psi5.Verb = "runas";
var process = new Process();
process.StartInfo = psi5;
process.Start();
process.WaitForExit();
}
private void EXSEG2_Click(object sender, EventArgs e)
{
var psi6 = new ProcessStartInfo();
psi6.FileName = "notepad.exe";
psi6.Arguments = @"C:\nam\EXSEG2.nam";
psi6.Verb = "runas";
var process = new Process();
process.StartInfo = psi6;
process.Start();
process.WaitForExit();
} |
Mon problème étant que seul le dernier bouton (ici EXSEG2) m'ouvre bien mon fichier .nam. Lorsque je clique sur les autres, rien ne se passe.
Quelqu'un aurait une idée ?
Je vous remercie de votre aide :ccool: