473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 2052
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

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

Similar topics

4
by: Bob | last post by:
well i pretty much said it in the title. i was wondering how would you make a picture box or an object repond to the arrow keys. for example i have a picture and i want to move right when i...
0
by: Svelte Poshy | last post by:
I want to put a code in the control box with a picture of an arrow, imitating the right arrow in the foot of the form with which the user views the customers one after another. My form is a...
6
by: Prakash | last post by:
Hi !! In a Continuous Form with say 10 records, I'd like to have 1 button with an "UP" Arrow & another button with a "DOWN" arrow. By pressing either the Up or the Down Arrow, I'd like the user...
7
by: Seash | last post by:
Hi friends , here is the sample code private void txtbox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if(e.KeyChar == 13) //enter { txtbox2.Focus(); }
4
by: AndyG | last post by:
Hey everyone. I just reinstalled my VS.Net and now for some reason, when i am in design mode and i try to move a control, it does not move the control. It ends up moving the scrollbar up or down as...
8
by: Doron Farber | last post by:
Hi All, How can I Move the Server explorer window to the left. When ever I double click on the Server explorer top window it goes to the bottom of the IDE. Thanks, Doron
1
by: VanKha | last post by:
How to move the cursor( I'm programming with Win32 console applications in visual c++ 6.0) by letting the user type in arrow keys(and obviously, I will then have some variable column and row and use...
2
by: sandromani | last post by:
Hello, I was wondering if there was a way (in c++) to move the cursor when pressing the arrow keys instead of getting ^[[C resp. ^[[D (left resp. right arrow) in the cin input - I am using linux. I...
0
by: ivan | last post by:
Hello, How do I move the keyboard cursor position in a Tix.HList? I am using an HList with the right mouse button bound to pop up a menu. If the right click is done on an unselected item, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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,...

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.