The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > General Programming > Visual Basic


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags:

Closed Thread
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 06-10-2007, 05:19 PM
f4b_4
Posts: n/a
[SOLVED] need help in showing pictures in a visual basic program?

the thing that im doing is an ipod, now in the photos form i want the photos to appear one by one when the user clicks on the command button that has an arrow to the right (i dont want it to be a slide show, i want the picture to change only when the user clicks on the command button)
plz state the whole code if you can, and try to make it easy plz.... and thnx by the way ;-)

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #2 (permalink)  
Old 06-10-2007, 05:19 PM
Deep Thought
Posts: n/a
assuming that you're using VB6:

- put all the pictures in a sub-folder of the folder where your program is installed, let's say this pictures subfolder is called "photos"

--------------------------------

- put a FileListBox (named File1) object on your form (it would be better to use the FileSystemObject object but I won't get into that, as it's a little more complicated),
so, on the form's Load Event write this:


Dim picturesFolder As String

'assuming that all your pictures are JPG
'if you have different types of pictures don't use the next line but make sure to put only pictures in that folder

File1.Pattern = "*.jpg"

'set the pictures folder

picturesFolder = App.Path & "\photos\"

'if the pictures folder exists and has files in it

If Dir(picturesFolder) <> "" Then
File1.Path = picturesFolder
Else
MsgBox "can't find pictures in " & picturesFolder
End If

'hide the file list, as we are using it only to get the file names

File1.Visible = False

'set the current index of the displayed file to 0 (the first file in the list)

crtIdx = 0

'display the first picture
If (File1.ListCount > 0) Then
Picture1.Picture = LoadPicture(File1.Path & "\" & File1.List(crtIdx))
end if

--------

- put a pictureBox object on your form (named Picture1)

--------

- make a private variable for the form to hold the current index of the displayed file (select General, then Declarations from the code window) and write

private crtIdx as Integer


--------

- on the button that you use to display the next picture (on the OnClick event) write this

' go to the next picture

If crtIdx < File1.ListCount - 1 Then
crtIdx = crtIdx + 1
Else
crtIdx = 0
End If

'display that picture
If (File1.ListCount > 0) Then
Picture1.Picture = LoadPicture(File1.Path & "\" & File1.List(crtIdx))
end if


if you're using VB .NET email me, I'll give you an example for that as well

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Closed Thread


Thread Tools
Display Modes

   Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 02:52 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


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 39 40 41 42 43 44 45 46 47 48 49 50