473,503 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with making a button to select the next text or file on a listbox

1 New Member
I am making a picture viewer and i want to make 2 buttons. one to skip to the next image and the other to go back to the previous image but i don't know the code for the listbox.
Jul 29 '12 #1
2 1139
Killer42
8,435 Recognized Expert Expert
Can you be more specific? The code to do what with the listbox?
Aug 7 '12 #2
IraComm
14 New Member
Assuming your have a picture box and a list box that points to picture files, this may help:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. 'used as the next button
  3. Dim FileName As String
  4.  
  5. If List1.ListIndex < List1.ListCount - 1 Then
  6.     List1.ListIndex = List1.ListIndex + 1
  7.     List1.Selected(List1.ListIndex) = True 'highlights the list item
  8.     FileName = List1.List(List1.ListIndex)
  9.  
  10.     Picture1.Picture = LoadPicture(FileName)
  11. End If
  12.  
  13. End Sub
  14.  
  15.  
  16. Private Sub Command2_Click()
  17. 'used as the previous button
  18. Dim FileName As String
  19.  
  20. If List1.ListIndex > 0 Then
  21.     List1.ListIndex = List1.ListIndex - 1
  22.     List1.Selected(List1.ListIndex) = True 'highlights the list item
  23.     FileName = List1.List(List1.ListIndex)
  24.  
  25.     Picture1.Picture = LoadPicture(FileName)
  26. End If
  27.  
  28. End Sub
  29.  
  30.  
Oct 30 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
1536
by: nephish | last post by:
Hey there, i have a text file with a bunch of values scattered throughout it. i am needing to pull out a value that is in parenthesis right after a certain word, like the first time the word...
9
1420
by: Vicky via DotNetMonster.com | last post by:
Please help with reading fields in a text file. I need to get the index name, (ticker field in text file), Please see one file as an example (There are actually 1000 files) If we open the file,...
1
1265
by: cabral | last post by:
hello, i have a program that has 2 arrays but the info to be used in the array is in 2 text files... i want to know how to call the text files. please and thankyou
2
2570
kamill
by: kamill | last post by:
i need to write content of one text file into another text file. My code is working ,if i choose both files from same directory where my program reside..BUT,its not working if i select files from...
10
16775
by: kimiraikkonen | last post by:
Hello, I have a moodest mp3 player which has a playlist as listbox1 which shows full path or each inserted file. The problem is, when a media playing is ended, i want my listbox to select...
1
1084
by: Perl Beginner | last post by:
Someone, Using Perl Script. I know there is an easy way to do this, but i'm just missing it. I have created a window using Win32::GUI::Window and I’ve added a button to this window. Now I’m trying...
1
6100
by: akaley | last post by:
Hi, Iam sending mail by using mailx command..for other files it's working file,,But while sending txt files..some junk characters are coming in place of new lines.. my text file containg marking...
3
2440
by: prayinjamat | last post by:
here are the parameters in which i am working: i have Google Maps mashup that uses a text file to contain all the data points i use the text file because i have no experience with mysql or any...
1
3550
by: ozchadl | last post by:
I wish to import some data I have in some (tab delited) files that I would like to import into certain tables in my access database. I would like to import them using SQL only. I know there are...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.