Résolu Problème affichage image ComboBox !

Inscription
26 Février 2016
Messages
185
Réactions
55
Points
2 456
(Re) Bonsoir :rgif: !

Petit problème avec mon code :

Code:
if (nsComboBox1.SelectedIndex == 0)
{
Image.FromFile(@"Resources\test.png");


}
if (nsComboBox1.SelectedIndex == 1)
{
Image.FromFile(@"Resources\100101.png");
}

L'image ne s'affiche pas et une erreur apparait , une solution ? :)
Merci !​
 
Inscription
26 Février 2016
Messages
185
Réactions
55
Points
2 456
Ba normal il faut que tu dises que pictureBox1 = à ça
Image.FromFile(@"Resources\test.png");
804419123456444.png


La commande reste en rouge ? Soucis de syntaxe ?
 
Inscription
26 Février 2016
Messages
185
Réactions
55
Points
2 456
pictureBox1.Image =
J'ai cette erreur qui apparait
Code:
[Host: 1.0.0.0, Loader: 2.0.0.6]

Resources\skype.png

System.IO.FileNotFoundException
   à System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
   à System.Drawing.Image.FromFile(String filename)
   à YoungTech.Form1.nsComboBox1_SelectedIndexChanged(Object sender, EventArgs e) dans C:\Users\Jocelyn\documents\visual studio 2015\Projects\YoungTech\YoungTech\Form1.cs:ligne 45
   à System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
   à System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
   à System.Windows.Forms.ComboBox.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.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   à System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
   à System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)
   à System.Windows.Forms.Control.WmCommand(Message& m)
   à System.Windows.Forms.Control.WndProc(Message& m)
   à System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   à System.Windows.Forms.ContainerControl.WndProc(Message& m)
   à ThemeContainer154.WndProc(Message& m) dans C:\Users\Jocelyn\documents\visual studio 2015\Projects\YoungTech\YoungTech\ThemeBase154.cs:ligne 258
   à 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.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   à System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
   à System.Windows.Forms.Control.DefWndProc(Message& m)
   à System.Windows.Forms.Control.WmCommand(Message& m)
   à System.Windows.Forms.Control.WndProc(Message& m)
   à System.Windows.Forms.ComboBox.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)
   à System.Windows.Forms.Application.Run(Form mainForm)
   à YoungTech.Program.Main() dans C:\Users\Jocelyn\documents\visual studio 2015\Projects\YoungTech\YoungTech\Program.cs:ligne 19
   à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   à System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   à System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
   à System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
   à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
   à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
   à System.Activator.CreateInstance(ActivationContext activationContext)
   à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
   à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   à System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   à System.Threading.ExecutionContext.R
 
Haut