| | |
need help with PICTURE
![]() |
•
•
Join Date: Mar 2006
Posts: 3
Reputation:
Solved Threads: 0
Hello
Can I get 20 pictures opened from visual basics, for example I have a list box with the name of the pictures, unfortunately I cannot open none of them, can someone please send me some code, all I want to do is have a right and left arrow, and each time a user pressed right it will display the next picture, can anyone please help.
thanks for looking
as i said i will have a list box, all i want to do is one the user click on the left and right arrow, it should disply the next picture, is there a way of me doing that, if so can you please show me the code, thanks again
Can I get 20 pictures opened from visual basics, for example I have a list box with the name of the pictures, unfortunately I cannot open none of them, can someone please send me some code, all I want to do is have a right and left arrow, and each time a user pressed right it will display the next picture, can anyone please help.
thanks for looking
as i said i will have a list box, all i want to do is one the user click on the left and right arrow, it should disply the next picture, is there a way of me doing that, if so can you please show me the code, thanks again
What is the type of the picture ? If it is something common like bmp, jpg etc, use a image or picture box control to display it.
Image1.Picture = Loadpicture(Full_Path_Of_The Picture_File)
If it is something that VB does not support, do you want to open the picture through an external program ? In that case, use the ShellExecute API function
Image1.Picture = Loadpicture(Full_Path_Of_The Picture_File)
If it is something that VB does not support, do you want to open the picture through an external program ? In that case, use the ShellExecute API function
Right. Something else you'll need to take into consideration is the size of the image. If you set it to be auto-size (the picture or image control) then it will change depending on the size of the picture.... if you don't, it will chop off the image so you can't see it all. Now, you could use an image control instead of a picturebox control, and set it's stretch property to true, which will shrink the image (or whatever) to the size of the image control, BUT it doesn't render the image with any kind of decent quality. When I wrote a picture viewer, I made a seperate form that was used as the viewer pane, and resized the entire form to a given ratio based on the size of the picturebox, so that way it didn't seem too flawed. Good luck with your project.
•
•
Join Date: Mar 2006
Posts: 14
Reputation:
Solved Threads: 0
Hello the picture will only be the standard type Jpg type, all I want is any code just to view 20 pictures, am not to concern about the size, I could probably do that. All I really need is the code to view the pictures, preferably with two arrows for example if the user point left arrow it will go to picture 20 and if her presses the right arrow it will go to picture 1.
I think I could have a list box with the picture in, is that the way you would do it, can you please send me an attachment, or your code if you have done it, and I need something similar
Please help me, am really confused
Thanks
I think I could have a list box with the picture in, is that the way you would do it, can you please send me an attachment, or your code if you have done it, and I need something similar
Please help me, am really confused
Thanks
I don't really have a code, but it's quite simple. You need a image or picturebox control to display the picture, u can't really do that in a list box.
Assuming there are 20 pictures, take an array for the filenames in the General Declarations section.
Dim strFiles(20) as string
Now put in the filenames in the array. Depending on ur project u can use a full path or a relative path.
strFiles(1) = PATH_OF_FILE1
strFiles(2) = PATH_OF_FILE2
....
strFiles(20) = PATH_OF_FILE20
Also declare a variable in the General Declarations section. This variable can be used as a counter.
Dim mCtr as integer
If there are 2 command buttons, cmdLeft and cmdRight, then in their click section write
assuming Picture1 to be Picturebox that will display the picture
In the same way write for cmdRight
and ur pictures will be displayed. Use the 2 buttons to browse through the pictures
Assuming there are 20 pictures, take an array for the filenames in the General Declarations section.
Dim strFiles(20) as string
Now put in the filenames in the array. Depending on ur project u can use a full path or a relative path.
strFiles(1) = PATH_OF_FILE1
strFiles(2) = PATH_OF_FILE2
....
strFiles(20) = PATH_OF_FILE20
Also declare a variable in the General Declarations section. This variable can be used as a counter.
Dim mCtr as integer
If there are 2 command buttons, cmdLeft and cmdRight, then in their click section write
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmdLeft_Click() if mCtr > 1 then mCtr = mCtr - 1 end if Picture1.Picture = LoadPicture(strFiles(mCtr)) End Sub
assuming Picture1 to be Picturebox that will display the picture
In the same way write for cmdRight
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub cmdRight_Click() if mCtr < 20 then mCtr = mCtr + 1 end if Picture1.Picture = LoadPicture(strFiles(mCtr)) End Sub
and ur pictures will be displayed. Use the 2 buttons to browse through the pictures
•
•
Join Date: Mar 2006
Posts: 3
Reputation:
Solved Threads: 0
Thanks for your code, however I still can’t make it work, the first picture does not even come up, it does execute but nothing happened, will it be possible for you to send an attachment in vb, so I can see how you make it work, you can put in any 2 or more pictures, once I know how it works I am sure I can make mine work too, don’t be tooo concern with the code, please help me make it work
Most of the code I have already given. To see the first picture when the form loads, write in the form -> load section
If you are getting an error, please specify the error number & description.
Comatose, sorry about last post. Remembered this time :o
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
strFiles(1) = PATH_OF_FILE1 ..... strFiles(20) = PATH_OF_FILE20 Image1.Picture = LoadPicture(strFiles(1))
If you are getting an error, please specify the error number & description.
Comatose, sorry about last post. Remembered this time :o
•
•
Join Date: Apr 2006
Posts: 4
Reputation:
Solved Threads: 0
the syntax is not correct but this is how i would approch it
global piccnt as interger' in a modual
onform load 'set the 1st picture
piccnt = 0
pitcure1.picture = filepath & listbox.listindex(piccnt)
sub click arrow button right
piccnt = piccnt + 1
if piccnt >then listcount.indexcount then piccnt = 0
pitcure1.picture = filepath & listbox.listindex(piccnt)
end sub
sub click arrow button left
piccnt = piccnt - 1
if piccnt <then listcount.indexcount then piccnt = listindex.count.lastin the index
pitcure1.picture = filepath & listbox.listindex(piccnt)
end sub
global piccnt as interger' in a modual
onform load 'set the 1st picture
piccnt = 0
pitcure1.picture = filepath & listbox.listindex(piccnt)
sub click arrow button right
piccnt = piccnt + 1
if piccnt >then listcount.indexcount then piccnt = 0
pitcure1.picture = filepath & listbox.listindex(piccnt)
end sub
sub click arrow button left
piccnt = piccnt - 1
if piccnt <then listcount.indexcount then piccnt = listindex.count.lastin the index
pitcure1.picture = filepath & listbox.listindex(piccnt)
end sub
![]() |
Similar Threads
- How Would I take A Picture Of My Desktop And Post It At A Forum As An JPG? (Geeks' Lounge)
- Change the Picture on the Welcome Screen (Windows tips 'n' tweaks)
- Can't print the picture (Web Browsers)
- can't open any picture files, gets an error (Windows NT / 2000 / XP)
- xp Picture folder (Windows NT / 2000 / XP)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: hello hope you can help me, have a look and let me know
- Next Thread: VB share where project
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






