473,404 Members | 2,195 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,404 software developers and data experts.

Image Arrays

lotus18
866 512MB
Hello World

I'm back again. LOL


How to make an image arrays? I have 6 images named Button (Index from 1-6). I'm working on MouseMove events these images. So far I have these codes:

Expand|Select|Wrap|Line Numbers
  1. Public Sub DefaultImage()
  2.     It should be array
  3.     For i = 1 To 6
  4.         Button(i).Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
  5.     Next i
  6. End Sub
  7.  
  8. Private Sub Button_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  9.    ...
  10. End Sub
  11.  
  12.  

This is my previous code and the Button were not on control arrays. This is working. I just want to shorten my codes. Thanks : )

Expand|Select|Wrap|Line Numbers
  1. Public Sub DefaultImage()
  2.     Button1.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
  3.     Button2.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
  4.     Button3.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
  5.     Button4.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
  6.     Button5.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
  7.     Button6.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
  8. End Sub
  9.  
  10. Private Sub Button1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  11.     DefaultImage
  12.     Button1.Picture = LoadPicture(App.Path & "\Images\ButtonHot.jpg")
  13. End Sub
  14.  
  15. ...
  16.  
  17. Private Sub Button6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  18.     DefaultImage
  19.     Button6.Picture = LoadPicture(App.Path & "\Images\ButtonHot.jpg")
  20. End Sub
  21.  
Jan 14 '08 #1
14 4140
debasisdas
8,127 Expert 4TB
What is the problem with the new code ?
Jan 14 '08 #2
QVeen72
1,445 Expert 1GB
Hi,

Just change your Mouse move event like this..


Expand|Select|Wrap|Line Numbers
  1. Public Sub DefaultImage()
  2.     Dim i As Integer
  3.     For i = 1 To 6
  4.         Button(i).Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
  5.     Next i
  6. End Sub
  7.  
  8. Private Sub Button_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  9.     DefaultImage
  10.     Button(Index).Picture = LoadPicture(App.Path & "\Images\ButtonHot.jpg")
  11. End Sub
  12.  
  13.  

Regards
Veena
Jan 14 '08 #3
lotus18
866 512MB
What is the problem with the new code ?
Hi

Thanks for replying. If you notice that on my first code line #9 it contains only .... Hehe...
Jan 14 '08 #4
lotus18
866 512MB
Hi Veena

Thanks. I'll try that later : )
Jan 14 '08 #5
lotus18
866 512MB
Hi,

Just change your Mouse move event like this..


Expand|Select|Wrap|Line Numbers
  1. Public Sub DefaultImage()
  2.     Dim i As Integer
  3.     For i = 1 To 6
  4.         Button(i).Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
  5.     Next i
  6. End Sub
  7.  
  8. Private Sub Button_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  9.     DefaultImage
  10.     Button(Index).Picture = LoadPicture(App.Path & "\Images\ButtonHot.jpg")
  11. End Sub
  12.  
  13.  

Regards
Veena
Hi Veena

I tried it and there's an error. The error says that an Compile Error: Expected Array :(
Jan 14 '08 #6
QVeen72
1,445 Expert 1GB
Hi,

Which Line you are getting the error...?
What version ? VB6 or VB.net...?


Regards
Veena
Jan 14 '08 #7
lotus18
866 512MB
Hi,

Which Line you are getting the error...?
What version ? VB6 or VB.net...?


Regards
Veena
Hi

Sorry for the late reply. I'm getting an error at line #10. I'm using vb6.
Jan 14 '08 #8
Killer42
8,435 Expert 8TB
In VB6, you're much better off using control arrays. But I don't quite understand what the problem is, or why you are moving away from control arrays.
Jan 15 '08 #9
Killer42
8,435 Expert 8TB
Sorry, I'm confused. which is the old code, and which is the new?
Jan 15 '08 #10
Killer42
8,435 Expert 8TB
I think this may be the line you're after...
Expand|Select|Wrap|Line Numbers
  1. Button(Index).Picture = LoadPicture(App.Path & "\Images\ButtonHot.jpg")
Jan 15 '08 #11
pureenhanoi
175 100+
Hi Veena

I tried it and there's an error. The error says that an Compile Error: Expected Array :(
This error occures caused of Pictures in your form in diffrent name (Button1, button2...)
If you want use the given code, set the same name for 6 picturebox. Just named them with "Button". If VB6 ask you to create an array of picturebox, click "Yes" to accept.
If you could see in the Property window, all of these picturebox have same name "Button", and the Index property is increment from 0..5. So that the good time for runing given code again.

I must edit some thing on my post, caused the given code use "For i=1 To 6"
You can use "For i=0 To 5" instead, or set the index of 6 pictureboxs increment from 1..6
Jan 15 '08 #12
lotus18
866 512MB
This error occures caused of Pictures in your form in diffrent name (Button1, button2...)
If you want use the given code, set the same name for 6 picturebox. Just named them with "Button". If VB6 ask you to create an array of picturebox, click "Yes" to accept.
If you could see in the Property window, all of these picturebox have same name "Button", and the Index property is increment from 0..5. So that the good time for runing given code again.

I must edit some thing on my post, caused the given code use "For i=1 To 6"
You can use "For i=0 To 5" instead, or set the index of 6 pictureboxs increment from 1..6
Hi

If notice on my 1st post, in code #1, I stated there that the name of my Image is Button and they are in array control (Index from 1 to 6). But in code #2 on the same post, my buttons which are the images are not in control array instead, they are named as Button1, Buttton2,...Button6

Rey Sean
Jan 16 '08 #13
hello world,
what is the code for arc sine and arc cosine please help thank you!
Jan 16 '08 #14
lotus18
866 512MB
hello world,
what is the code for arc sine and arc cosine please help thank you!
Hello

You are out of the topic. Please start a new thread.

Rey Sean
Jan 16 '08 #15

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

Similar topics

15
by: 1 | last post by:
hi there i need a site where the client can upload an image every week, with a caption, (so pref use the php upload image function to provide a web based interface) and that then automatically...
6
by: Olly | last post by:
I've found a basic script, however I also need to add alt and title attributes as well, how would I go about doing this? Here's the script I found: Thanks <script language="JavaScript"> <!--...
2
by: Dennis Allen | last post by:
Hi. I have a piece of client-side code that searches the current page's links. If it determines a link < 60 days ago, it uses document.links.innerHTML += '&nbsp;<img src="'+_img.src+'">', where...
1
by: sympatico | last post by:
Hi, I am trying to compare 2 images to check if they are exactly identical (in terms of data), I thought this would be quicker than analysing pixels of the images. I have found lots of examples...
2
by: 1388-2/HB | last post by:
I've got a small sockets application where I communicate with a web server via async sockets method. Using the ASCIIEncoding Class, I convert strings to byte arrays (and vice versa) in...
13
by: giovanniparodi79 | last post by:
Hello everybody is there some utility to convert a raw image in an header file? Thanks everybody Gio
10
by: =?Utf-8?B?UmludSBHb3BhbGFrcmlzaG5hIFBpbGxhaQ==?= | last post by:
Hi, Please help me to write a dll in C# , that will read each pages of a tiff image from a file and a memory stream object ( need two ways) and creatre a new tiff image object.The dll should...
4
by: akynaya | last post by:
i've already had my image arrays working but i need to place them one at a time in a picture box through the use of a command button. The system works like everytime the command button is clicked,...
36
by: vimal3271 | last post by:
I want to know how to read image files in C.. what are the headers that i should include? is there any tutorials regarding this ? pls inform me.
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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...
0
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
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...

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.