Picturebox Control Question
-
Hi all, I started learning VB.NET a few months ago and I love it. What I'm having trouble with though is that I'm trying to assign a picturebox to a listbox so that the picture changes when selecting another item. But I can't figure out how. The pictures are in the project resource files, how do I assign them to the process? There's 78 pictures. :) The form with the picturebox and listbox.[^] Cheers!
-
Hi all, I started learning VB.NET a few months ago and I love it. What I'm having trouble with though is that I'm trying to assign a picturebox to a listbox so that the picture changes when selecting another item. But I can't figure out how. The pictures are in the project resource files, how do I assign them to the process? There's 78 pictures. :) The form with the picturebox and listbox.[^] Cheers!
-
Hi all, I started learning VB.NET a few months ago and I love it. What I'm having trouble with though is that I'm trying to assign a picturebox to a listbox so that the picture changes when selecting another item. But I can't figure out how. The pictures are in the project resource files, how do I assign them to the process? There's 78 pictures. :) The form with the picturebox and listbox.[^] Cheers!
First, it depens on how you want to use resources. Are these embeded pictures as resources in your project or you are going to load them from references or from a specific directory. :wtf:
What a curious mind needs to discover knowledge is noting else than a pin-hole.
-
First, it depens on how you want to use resources. Are these embeded pictures as resources in your project or you are going to load them from references or from a specific directory. :wtf:
What a curious mind needs to discover knowledge is noting else than a pin-hole.
Well what I want to do is; When the user selects an item in the ListBox, the PictureBox loads a file from the resources and displays it, and when the user selects another item, the PictureBox do the same procedure but gets another picture. Since I've never used code to grab something from the resources, I have no clue on where and how I'm gonna load them. A friend of mine gave me this[^] link where it was described how a PictureBox could be used.
pictureBox1.Image = _ new Bitmap(Assembly.GetExecutingAssembly(). _ GetManifestResourceStream("PictureBoxControl.tinyemulator_res.jpg"))
The issue with this is that first Assembly is undefined and second that, well I have no freakin' idea on where the UI input should be. Is that enough to help me? :) Cheers! -
Well what I want to do is; When the user selects an item in the ListBox, the PictureBox loads a file from the resources and displays it, and when the user selects another item, the PictureBox do the same procedure but gets another picture. Since I've never used code to grab something from the resources, I have no clue on where and how I'm gonna load them. A friend of mine gave me this[^] link where it was described how a PictureBox could be used.
pictureBox1.Image = _ new Bitmap(Assembly.GetExecutingAssembly(). _ GetManifestResourceStream("PictureBoxControl.tinyemulator_res.jpg"))
The issue with this is that first Assembly is undefined and second that, well I have no freakin' idea on where the UI input should be. Is that enough to help me? :) Cheers! -
Well what I want to do is; When the user selects an item in the ListBox, the PictureBox loads a file from the resources and displays it, and when the user selects another item, the PictureBox do the same procedure but gets another picture. Since I've never used code to grab something from the resources, I have no clue on where and how I'm gonna load them. A friend of mine gave me this[^] link where it was described how a PictureBox could be used.
pictureBox1.Image = _ new Bitmap(Assembly.GetExecutingAssembly(). _ GetManifestResourceStream("PictureBoxControl.tinyemulator_res.jpg"))
The issue with this is that first Assembly is undefined and second that, well I have no freakin' idea on where the UI input should be. Is that enough to help me? :) Cheers!Please check this link out http://msmvps.com/blogs/JayHarlow/default.aspx[^] It can give you an idea. If I were you, I would use embeded resources of course it is much easier to deal. Also here is another approach:
The following example uses the ResourceManager.GetObject method to retrieve and display a binary resource (such as a graphic image). … Dim private rm As ResourceManager rm = New ResourceManager("MyImages", Me.GetType().Assembly) PictureBox.Image = Ctype(rm.GetObject("MyObject"), System.Drawing.Image) …
:wtf: -- modified at 16:24 Monday 12th March, 2007
What a curious mind needs to discover knowledge is noting else than a pin-hole.