5 Replies - 839 Views - Last Post: 08 February 2012 - 07:50 AM Rate Topic: -----

Topic Sponsor:

#1 nicky02090  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-February 12

How to open more pictures in one picturebox (Visual Basic 2010 Expres)

Posted 07 February 2012 - 03:10 PM

Hey, I am totaly new here, I before programmed in C/C++, but never in Basic, so please help!

So, my problem is all in the title actually, and that is that I have to open more pictures in one picturebox, and I don't know how to do it. I cannot open more pics in more picturebox 'cause of many things. So one picturebox, 2 or more pics, and I want a answer! Thank you

btw-sorry, english is not my mother tongue so sorry if it sucks, and sorry if you don't quite understand what is my problem but I will try to be specific next time

Is This A Good Question/Topic? 0
  • +

Replies To: How to open more pictures in one picturebox (Visual Basic 2010 Expres)

#2 tlhIn`toq  Icon User is offline

  • WillMyCodeWork = !FailedWhenYouTriedIt;
  • member icon

Reputation: 3290
  • View blog
  • Posts: 6,898
  • Joined: 02-June 10

Re: How to open more pictures in one picturebox (Visual Basic 2010 Expres)

Posted 07 February 2012 - 03:21 PM

It doesn't work that way.
1 picturebox control... 1 image. Period.

If you want to show several pictures in a picturebox you will either have to make a composite of them all, if you want to show that at one time... Or you will have to change the image if you want to show them in sequence.

There is a Picturebox.Image property. You set that. So if you want a slideshow of images you would...

set the image
wait 3 second
set the next image
wait 3 second
set the third image
wait 3 second
<repeat>
Was This Post Helpful? 0
  • +
  • -

#3 nicky02090  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-February 12

Re: How to open more pictures in one picturebox (Visual Basic 2010 Expres)

Posted 08 February 2012 - 02:37 AM

well, I want show several images in one picturebox, by adding them with clicking. Something like: click on the button, show that image, click on the other button show that image and the image before, how can I do something like that?
Was This Post Helpful? 0
  • +
  • -

#4 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 211
  • View blog
  • Posts: 1,249
  • Joined: 26-March 09

Re: How to open more pictures in one picturebox (Visual Basic 2010 Expres)

Posted 08 February 2012 - 03:15 AM

And you want to show them how in the picture box? Tiled? Overlapping? Merged? If you give an example of exactly what you're trying to achieve, then you might get a more specific answer.

In the meantime have a google on the BitBlt API and see if that will give you what you want.

This post has been edited by maj3091: 08 February 2012 - 03:16 AM

Was This Post Helpful? 1
  • +
  • -

#5 tlhIn`toq  Icon User is offline

  • WillMyCodeWork = !FailedWhenYouTriedIt;
  • member icon

Reputation: 3290
  • View blog
  • Posts: 6,898
  • Joined: 02-June 10

Re: How to open more pictures in one picturebox (Visual Basic 2010 Expres)

Posted 08 February 2012 - 07:25 AM

View Postnicky02090, on 08 February 2012 - 03:37 AM, said:

well, I want show several images in one picturebox, by adding them with clicking. Something like: click on the button, show that image, click on the other button show that image and the image before, how can I do something like that?


What part of my earlier answer confused you?

View PosttlhIn`toq, on 07 February 2012 - 04:21 PM, said:

you will either have to make a composite of them all, if you want to show that at one time... Or you will have to change the image if you want to show them in sequence.



If by "how can I do something like that?" you are asking us to write your code for doing it... That doesn't happen here.



This is the 'Help me with my homework' article you wanted.
Stages of asking for homework help on a forum.
I don't want you to write my code, just give me ideas on how to solve my problem.
"It doesn't work" isn't good enough - Read this article

What have to you tried to code so far?
What part of what you have tried isn't working?
Are you getting error messages, or is it just not giving you the results you wanted?

(In other words, you at least have to make and show us your good faith effort to do your own coding. We are here to help you, not do it for you.)
What does this error mean?

Suggestion:
Don't replace lines of code that don't work. Instead comment them out and put your new attemps below that. This will keep you from re-trying the same ideas over and over. Also, when you come back to us saying "I've tried this 100 different ways and still can't get it", we can actually see what you tried. So often a failed attempt is very very close and just needs a little nudge in the right direction. So if we can say "See what you did in attempt 3... blah blah" it helps a lot

// Try #1 - May 1, 0900hrs
//    code
//    code  
//    code
// Try #2 - May 2, 1700hrs   Okay, plan B.  What if I do it *this* way
//    code
//    code  
//    code
// Try #14 - May 3, 0500hrs after 5 cans of RedBull.  Maybe I should get some sleep. I can't think of anything else but this last idea
    code
    code  
    code


If you are using Visual Studio you can select a block of lines and hit control+k control+c (Kode Comment) to comment it out. control+k control+u (Kode Uncomment) to uncomment a selected block.



I will make a common suggestion though: Quit trying to develop your own application before you lean *how* to code in your chosen language. Trying to write a program from scratch as a learning exercise never works this early in your schooling.

Reacting to a button.click is covered very early on in any self-teaching book. Which makes me think you really aren't ready to be designing an application yet.

Some of the tutorials below are for C# not C, C++, VB.NET [...]. But the conceptual stuff of classes, object oriented design, events etc. are not language specific and should give you enough guidance in theory of program development for you to be able to look-up specific code example in your chosen coding language.

Newbie/Rookie said:

I have a little programming experience but I need to write ...


You need to start there. I can't say "I have little experience in speaking Russian, but I have been assigned to write a mystery novel in Russian. Can you help me?"

We can help you by saying "First learn basic programming and the language of C#. Then take on assignments." Could someone here write this program for you? Sure. Could someone here map out all the processes you need to follow and do the Software Design part of this in the slim hope you could code it from there? Sure. But we don't volunteer to do the job that you're either getting paid for, or getting a grade for. You may want to read this.

For now, just work on the lessons. Do a self-teaching book from cover to cover. Then consider writing a program.

Don't try to create a useful working program to fit a need of yours (or a for-pay contract) as your introduction to coding project. When you are learning to code you don't know enough to code a program, let alone know how to engineer the architecture of a program. It would be like saying "I don't know how to read sheet music, or play an instrument. I think I'll write a 3 act opera as my first learning experience."

I don't say this to be mean. We've seen lots of new coders take this approach and we know it doesn't work. Trying to design your own programs before you understand the basics of the code language you've chosen just leads to problems, frustrations, and 'swiss-cheese' education (lots of holes).


Resources, references and suggestions for new programmers. - Updated Jan 2012
Spoiler

Was This Post Helpful? 0
  • +
  • -

#6 Toadill  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 34
  • View blog
  • Posts: 274
  • Joined: 08-January 12

Re: How to open more pictures in one picturebox (Visual Basic 2010 Expres)

Posted 08 February 2012 - 07:50 AM

View Postmaj3091, on 08 February 2012 - 05:15 AM, said:

And you want to show them how in the picture box? Tiled? Overlapping? Merged? If you give an example of exactly what you're trying to achieve, then you might get a more specific answer.

In the meantime have a google on the BitBlt API and see if that will give you what you want.


I would have to agree with maj3091 you should be able to do this using the Win32 API BitBlt. You will have to learn how to buffer an picture on top of another picture. This function allows you to do so. I have used this API in the past to create animations for very basic games.

Without this API it would be impossible rather then loading a single image at a time. You said you would like to display a picture each time a command button is clicked, what you could do is either load the path of the picture each time or create a picturebox for each picture then make all but the displaying picture visibility = false, then all you would have to do is assign a non visible picture to the visible one.

For example
'display picture would be the only picture visible 
picDisplay.picture = picCar.picture


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1