Erreur : FileNotFoundException

Résolu
lemonwarez Messages postés 26 Date d'inscription mercredi 18 avril 2007 Statut Membre Dernière intervention 2 juillet 2010 - 21 déc. 2008 à 15:17
lemonwarez Messages postés 26 Date d'inscription mercredi 18 avril 2007 Statut Membre Dernière intervention 2 juillet 2010 - 21 déc. 2008 à 16:58
Bonjour,

J'ai fait un petit programme en Visual Basic mais j'ai une erreur indiquant : FireNotFoundException

Voila le script :

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Shell("C:\Program.pl" & TextBox1.Text & "" & TextBox2.Text & "" & TextBox3.Text)
    End Sub

(La commande est de ce style : Program.pl 192.168.0.1 1234 1000)

Pouvez vous m'aider ?

Merci

9 réponses

NHenry Messages postés 15112 Date d'inscription vendredi 14 mars 2003 Statut Modérateur Dernière intervention 13 avril 2024 159
21 déc. 2008 à 16:22
Bonjour,

Il me semble qu'il manque un espace après ".pl" :
Shell("C:\Perl\bin\perl.exe C:\program.pl" & TextBox1.Text & " " & TextBox2.Text & " " & TextBox3.Text)

http://nhen0039.chez-alice.fr/index.php
3
NHenry Messages postés 15112 Date d'inscription vendredi 14 mars 2003 Statut Modérateur Dernière intervention 13 avril 2024 159
21 déc. 2008 à 15:36
Bonjour,

Tu t'es trompé de catégorie, c'est du .NET et pas du VB6, mais pas la peine de reposter.

Essay juste :
Shell("C:\Program.pl")

Et tu verra ça ne marche pas car :
- Chemin en dur, peut être que Program.pl est ailleurs
- Ensuite, .PL n'est pas directement executable, en .NET, je te conseil de regarder du coté de System.Diagnostics.Process

http://nhen0039.chez-alice.fr/index.php
0
The Meteorologist Messages postés 232 Date d'inscription jeudi 18 janvier 2007 Statut Membre Dernière intervention 3 novembre 2011 1
21 déc. 2008 à 15:39
Bien il me semble que c'est assez clair, le fichier : "C:\Program.pl" & TextBox1.Text & "" & TextBox2.Text & "" & TextBox3.Text n'existe pas.

Pour éviter l'exception tu peux :
Vérifier que le fichier existe de cette manière :

If IO.File.Exists("C:\Program.pl" & TextBox1.Text & "" & TextBox2.Text & "" & TextBox3.Text) Then

' Ton code si le fichier existe.
Else

' Ton code si le fichier n'existe pas.
End if


Ou bien tu peux faire un bloc try catch :

Try
' Ton code si le fichier existe.
Catch ex As IO.IOException
' Ton code si le fichier n'existe pas.
End Try

Voilà ;)
0
The Meteorologist Messages postés 232 Date d'inscription jeudi 18 janvier 2007 Statut Membre Dernière intervention 3 novembre 2011 1
21 déc. 2008 à 15:42
Oups, au temps pour moi, la remarque de NHenry est plus pertinente.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
lemonwarez Messages postés 26 Date d'inscription mercredi 18 avril 2007 Statut Membre Dernière intervention 2 juillet 2010
21 déc. 2008 à 15:50
Shell("C:\Perl\bin\perl.exe C:\program.pl" & TextBox1.Text & " " & TextBox2.Text & " " & TextBox3.Text)

La, aucune erreur mais dans mon programme, rien ne ce passe quand j'indique TextBox1 TextBox2 TextBox3

Une idée :/ ?
0
NHenry Messages postés 15112 Date d'inscription vendredi 14 mars 2003 Statut Modérateur Dernière intervention 13 avril 2024 159
21 déc. 2008 à 15:54
Bonjour,

Essaye de taper la ligne à la main dans le menu démarrer/executer, Si rien ne se passe, c'est ton .PL (ou la convntion de passage des paramètres à ton programme) qu'il faut revoir, sinon, je ne vois pas.

http://nhen0039.chez-alice.fr/index.php
0
lemonwarez Messages postés 26 Date d'inscription mercredi 18 avril 2007 Statut Membre Dernière intervention 2 juillet 2010
21 déc. 2008 à 16:04
C:\Perl\bin\perl.exe C:\program.pl : Ouverture puis fermeture directe
C:\Perl\bin\perl.exe C:\program.pl 192.168.0.3 1234 1000 : Fonctionne ...
0
cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 40
21 déc. 2008 à 16:20
manquerait-il pas un espace après le program.pl par hasard ????

---- Sevyc64  (alias Casy) ----<hr size="2" width="100%" /># LE PARTAGE EST NOTRE FORCE #    http://aide-office-vba.monforum.com/index.php
0
lemonwarez Messages postés 26 Date d'inscription mercredi 18 avril 2007 Statut Membre Dernière intervention 2 juillet 2010
21 déc. 2008 à 16:58
MERCI !
Cela fonctionne à merveille !

Merci à tous !
0
Rejoignez-nous