Hi-

How can I change the content of the PictureBox control based on user entry? I'm assuming it would be similar to this:

If (TextBox1.Text = "Test") Then
     Picturebox1.Picture= (testpic.jpg)
End If

Recommended Answers

All 13 Replies

Hi-

How can I change the content of the PictureBox control based on user entry? I'm assuming it would be similar to this:

If (TextBox1.Text = "Test") Then
     Picturebox1.Picture= (testpic.jpg)
End If

Yes it would be like it, on the basis of the user name who logged in you can change the picture image accordingly.
Also you can set the user name as session variable to the user who logged in and this value can checked at any page on the application.

That helps...kinda.

How can I load an image from my resource list? Here is a better example:

If (ComboBox1.Text = Sky) Then
     Picturebox1.Picture = sky.jpg
End if

Hi-

How can I change the content of the PictureBox control based on user entry? I'm assuming it would be similar to this:

If (TextBox1.Text = "Test") Then
     Picturebox1.Picture= (testpic.jpg)
End If

Use Image class.

PictureBox1.Image= Image.FromFile("c:\folder\file.gif")

Use Image class.

PictureBox1.Image= Image.FromFile("c:\folder\file.gif")

Perfect, thanks.

Use Image class.

PictureBox1.Image= Image.FromFile("c:\folder\file.gif")

OK, your idea worked, but how can load an image from my imported resources list? With Image.FromFile, it requires me to enter a file route. I'm using a ComboBox and I want the user to select a image from a list I made.

Does that make sense?

>Does that make sense?

Yes sir.

>but how can load an image from my imported resources list?

PictureBox1.Image= My.Resources.your_resource_key

>Does that make sense?

Yes sir.

>but how can load an image from my imported resources list?

PictureBox1.Image= My.Resources.your_resource_key

Thanks, please bare with me for a few more questions :$

A) When I publish the application, does it automatically build the image it into the application, so the applictaion can be used on other computers?

B) How can I find the resource key? Is it the same as the Name property of the resource?

Sorry, I'm just learning to tie my shoes in the developing world. :)

You could try loading the image from the application's start-up path like this:

PictureBox1.Load(Application.StartupPath + "\img.jpg")

This would be my approach.

Hello, I'm with a little problem on my project..
Well, I have 2 Forms (1 and 2) I have a image selector on the form1 and I want to when the form2 run's the image on the Picturebox1 of the form1 appears in another PictureBox1 but on the form2 . I don't know if I explain me good, because i'm not english .. Wish you understand , and can help me !! PLEASE !!

on Form1 you have to save the picture that you choose in the global(public) variable.
and then on Form2 you just call it.

Dude here one of the attachment and get it....
And as soon as your answer solved, then please marked your thread as Solved.
The attachment includes the information too, i.e. explaining the codes with comments.

Include both type: Browsing an image and also selecting image from resource file with combobox

Attachment :

OOps, Seems it exceed the range of upload,
Don't worry I will update answer afterward.

attachment

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.