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: - Public Sub DefaultImage()
-
It should be array
-
For i = 1 To 6
-
Button(i).Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
-
Next i
-
End Sub
-
-
Private Sub Button_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
-
...
-
End Sub
-
-
This is my previous code and the Button were not on control arrays. This is working. I just want to shorten my codes. Thanks : ) - Public Sub DefaultImage()
-
Button1.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
-
Button2.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
-
Button3.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
-
Button4.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
-
Button5.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
-
Button6.Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
-
End Sub
-
-
Private Sub Button1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
-
DefaultImage
-
Button1.Picture = LoadPicture(App.Path & "\Images\ButtonHot.jpg")
-
End Sub
-
-
...
-
-
Private Sub Button6_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
-
DefaultImage
-
Button6.Picture = LoadPicture(App.Path & "\Images\ButtonHot.jpg")
-
End Sub
-
14 4140
What is the problem with the new code ?
Hi,
Just change your Mouse move event like this.. -
Public Sub DefaultImage()
-
Dim i As Integer
-
For i = 1 To 6
-
Button(i).Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
-
Next i
-
End Sub
-
-
Private Sub Button_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
-
DefaultImage
-
Button(Index).Picture = LoadPicture(App.Path & "\Images\ButtonHot.jpg")
-
End Sub
-
-
Regards
Veena
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...
Hi Veena
Thanks. I'll try that later : )
Hi,
Just change your Mouse move event like this.. -
Public Sub DefaultImage()
-
Dim i As Integer
-
For i = 1 To 6
-
Button(i).Picture = LoadPicture(App.Path & "\Images\ButtonNormal.jpg")
-
Next i
-
End Sub
-
-
Private Sub Button_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
-
DefaultImage
-
Button(Index).Picture = LoadPicture(App.Path & "\Images\ButtonHot.jpg")
-
End Sub
-
-
Regards
Veena
Hi Veena
I tried it and there's an error. The error says that an Compile Error: Expected Array :(
Hi,
Which Line you are getting the error...?
What version ? VB6 or VB.net...?
Regards
Veena
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.
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.
Sorry, I'm confused. which is the old code, and which is the new?
I think this may be the line you're after... - Button(Index).Picture = LoadPicture(App.Path & "\Images\ButtonHot.jpg")
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
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
hello world,
what is the code for arc sine and arc cosine please help thank you!
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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">
<!--...
|
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 += ' <img src="'+_img.src+'">', where...
|
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...
|
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...
|
by: giovanniparodi79 |
last post by:
Hello everybody is there some utility to convert a raw image in an
header file?
Thanks everybody
Gio
|
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...
|
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,...
|
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.
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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...
|
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...
|
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...
| |