IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

pointeur de variable vers une fonction


Sujet :

VB.NET

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Taxi
    Inscrit en
    Août 2016
    Messages
    17
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Val d'Oise (Île de France)

    Informations professionnelles :
    Activité : Taxi

    Informations forums :
    Inscription : Août 2016
    Messages : 17
    Points : 7
    Points
    7
    Par défaut pointeur de variable vers une fonction
    Bonjour,

    L’appui sur un bouton va chercher la valeur d’une clé de registre.
    Cette valeur = readvalue = un chemin d’acces (S:/blabla/grossomodo/)

    Je voudrais qu’une resource (blabla.jpeg) aille dans le chemin a l'interieur de readvalue.
    Mon WriteAllBytes veut absolument un path du genre S:/blabla/grossomo

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim readvalue As String
            readvalue = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\Blabla\blabla", "AppPath", Nothing)
            If readvalue Is Nothing Then
                MsgBox("Blabla n'a pas été trouvé.")
            Else
                My.Computer.FileSystem.WriteAllBytes(readvalue & "blabla.jpg", My.Resources.blabla, False)
                MsgBox("blabla a été mis à jour.")
            End If
        End Sub
    Ca coince apres le WriteAllbytes il veut un path et moi je veux le path qui se trouve dans readvalue
    Comment faire?

  2. #2
    Expert éminent sénior Avatar de Pol63
    Homme Profil pro
    .NET / SQL SERVER
    Inscrit en
    Avril 2007
    Messages
    14 154
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : .NET / SQL SERVER

    Informations forums :
    Inscription : Avril 2007
    Messages : 14 154
    Points : 25 072
    Points
    25 072
    Par défaut
    quel est le message d'erreur ?
    que contient réellement readvalue ?
    Cours complets, tutos et autres FAQ ici : C# - VB.NET

  3. #3
    Futur Membre du Club
    Homme Profil pro
    Taxi
    Inscrit en
    Août 2016
    Messages
    17
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Val d'Oise (Île de France)

    Informations professionnelles :
    Activité : Taxi

    Informations forums :
    Inscription : Août 2016
    Messages : 17
    Points : 7
    Points
    7
    Par défaut
    Bonsoir pol63

    Le message d'erreur Une exception non gérée du type 'System.ArgumentException' s'est produite dans mscorlib.dll
    Informations supplémentaires : Caractères non conformes dans le chemin d'accès.

    readvalue contient un chemin d'accès S:/My folder/Mon fichier

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    L'exception System.ArgumentException n'a pas été gérée
      HResult=-2147024809
      Message=Caractères non conformes dans le chemin d'accès.
      Source=mscorlib
      StackTrace:
           à System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
           à System.IO.Path.GetFileName(String path)
           à System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
           à Microsoft.VisualBasic.FileIO.FileSystem.WriteAllBytes(String file, Byte[] data, Boolean append)
           à Microsoft.VisualBasic.MyServices.FileSystemProxy.WriteAllBytes(String file, Byte[] data, Boolean append)
           à XXX.Form1.Button1_Click(Object sender, EventArgs e) dans C:\Users\XXX\Documents\Visual Studio 2013\Projects\XXX\XXX\Form1.vb:ligne 9
           à System.Windows.Forms.Control.OnClick(EventArgs e)
           à System.Windows.Forms.Button.OnClick(EventArgs e)
           à System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
           à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           à System.Windows.Forms.Control.WndProc(Message& m)
           à System.Windows.Forms.ButtonBase.WndProc(Message& m)
           à System.Windows.Forms.Button.WndProc(Message& m)
           à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
           à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
           à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
           à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
           à XXX.My.MyApplication.Main(String[] Args) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 81
           à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           à System.Threading.ThreadHelper.ThreadStart()
      InnerException:

  4. #4
    Expert éminent sénior Avatar de Pol63
    Homme Profil pro
    .NET / SQL SERVER
    Inscrit en
    Avril 2007
    Messages
    14 154
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Puy de Dôme (Auvergne)

    Informations professionnelles :
    Activité : .NET / SQL SERVER

    Informations forums :
    Inscription : Avril 2007
    Messages : 14 154
    Points : 25 072
    Points
    25 072
    Par défaut
    un chemin sous windows contient des \
    pas des /
    Cours complets, tutos et autres FAQ ici : C# - VB.NET

  5. #5
    Futur Membre du Club
    Homme Profil pro
    Taxi
    Inscrit en
    Août 2016
    Messages
    17
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Val d'Oise (Île de France)

    Informations professionnelles :
    Activité : Taxi

    Informations forums :
    Inscription : Août 2016
    Messages : 17
    Points : 7
    Points
    7
    Par défaut
    Autant pour moi la valeur de readvalue est bien S:\My folder\Mon fichier

  6. #6
    Futur Membre du Club
    Homme Profil pro
    Taxi
    Inscrit en
    Août 2016
    Messages
    17
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Val d'Oise (Île de France)

    Informations professionnelles :
    Activité : Taxi

    Informations forums :
    Inscription : Août 2016
    Messages : 17
    Points : 7
    Points
    7
    Par défaut
    Du coup ça ne m'avance pas vraiment? Je ne suis pas programmeur, j'aimerais savoir si c'est faisable, sinon je laisse tomber et je cherche un autre moyen. A vrai dire je pique des bons de code par ci par la....c'est la galére en faite

Discussions similaires

  1. Problème passage de variable vers une fonction
    Par Ersch dans le forum Débuter
    Réponses: 4
    Dernier message: 05/03/2014, 14h38
  2. Utilité d'un pointeur vers une fonction ?
    Par Nasky dans le forum C
    Réponses: 10
    Dernier message: 20/03/2010, 19h54
  3. [Perl/Tk] problème pour faire passer des variables vers une fonction
    Par seben dans le forum Interfaces Graphiques
    Réponses: 2
    Dernier message: 09/03/2009, 15h17
  4. Transferer variable vers une autre fonction.
    Par kelepoc dans le forum GTK+ avec C & C++
    Réponses: 1
    Dernier message: 02/05/2008, 21h08
  5. Fonction appelant un pointeur vers une fonction
    Par jacklafrip dans le forum C++
    Réponses: 8
    Dernier message: 30/01/2008, 14h06

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo