469,613 Members | 1,175 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

how can i move on the first picture from the last picture by pressing the right arrow

sir i have made a picture viewer application and i have a dirlistbox ,filelistbox ,drivelistbox and image list control on it .now when i select the drive where i have pictures and select the folder from the dirlist box and click on name of the picture in the file list box then the picture is displayed in the image list control.and when i press the right arrow key the next picture is displayed .now the problem is that how can i move from the last picture to the first picture by pressing the right arrow key.please help
Jun 12 '07 #1
9 1806
Killer42
8,435 Expert 8TB
Can you provide details on exactly how you move to the next picture when the arrow key is pressed? (Is this simply due to the built-in keyboard navigation in the file list?)

Also, what version of VB is this?
Jun 12 '07 #2
sir the version of vb that i am using is Visual basic 6.0.
sir now i am submitting the details.i have made a picture viewer application .on which i have placed a image control and dirlistbox ,drivelistbox,and the filelistbox. in the coding of the file listbox i have entered
Expand|Select|Wrap|Line Numbers
  1. Private Sub file1_click()
  2.   Dim hello As String
  3.   hello = file1.Path & "\" & file1.FileName
  4.   If Right$(hello, 3) = "jpg" Then
  5.     image1.Picture = LoadPicture(hello)
  6.   Else
  7.     image1.Picture = LoadPicture(hello)
  8.   End If
  9.   If file1.ListIndex = file1.ListCount - 1 Then
  10.     file1.ListIndex = 0
  11.   End If
  12. End Sub
according to this coding when i press the right arrow key then the next image is displayed in the image control.but when i reach on the end or at the last picture then the last picture is not displayed .now i want that when i reach on the last picture then the last picture should be displayed and when i again press the right arrow key then the first image should be displayed(as in the window picture and fax viewer).
Jun 12 '07 #3
debasisdas
8,127 Expert 4TB
u are moving to the next picture not because of your code ,but because of windows as th efocus is moving to the next item in the list.

try handling the keystroke and then try to change the index of the selected item in the list accordingly.
Jun 12 '07 #4
kadghar
1,295 Expert 1GB
Hi,

I'd say that it's because sometimes the indexes of the file pickers start at 1.

Then just change the code to:

if file1.listindex=file1.listcount then
file1.listindex=1
end if
end sub
Good Luck
Jun 12 '07 #5
dear sir

the listindex of the file list box starts from 0 and the listcount is 1 greater than the last index of the filelilstbox.the coding that you send me is
if file1.listindex=file1.listcount then
file1.listindex=1
end if
according to this coding the listindex can not becomes equal to the listcount .therefore the after the last picture the first picture is not displayed when i press the right arrow key.
please help
Jun 13 '07 #6
dear sir
i know that i am not moving on the next picture through my code but i want that when i reach on the last picture and again i press the right arrow key then the first picture should be displayed.please send me the code so that i can understand the code and utilize it.
Jun 13 '07 #7
debasisdas
8,127 Expert 4TB
dear sir
i know that i am not moving on the next picture through my code but i want that when i reach on the last picture and again i press the right arrow key then the first picture should be displayed.please send me the code so that i can understand the code and utilize it.
once list index is equal to listcount-1, rest it to 0

Now lets see how u apply the logic.

next time post with your code ,what u have tried
Jun 13 '07 #8
kadghar
1,295 Expert 1GB
Hi,

Sorry that didnt work (sometimes does)

May be it's a problem when you change the list index, and you can use a line like this:

Expand|Select|Wrap|Line Numbers
  1. file1.ListIndex = file1.ListIndex + 1
What have you already tried?
Jun 13 '07 #9
sir i have tried this logic like
if file1.listindex=file1.listcount-1 then
file1.listindex=0
end if
but according to this code the last picture is missed(not displayed) when the listindex become equal to the listcount-1 then focus jumps on the first picture.
Jun 13 '07 #10

Post your reply

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

Similar topics

4 posts views Thread by AndyG | last post: by
8 posts views Thread by Doron Farber | last post: by
2 posts views Thread by sandromani | last post: by
reply views Thread by ivan | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.