|
-
Jul 14th, 2002, 11:50 PM
#1
Thread Starter
Member
Question about For next and variable
Hi everyone!!!
Here is my problem:
I used the code of a graphic filther that I found on this site
(here's the code) |
|
V
For x = 1 To FrmDessin1.PictureDessin.ScaleHeight - 3
For y = 1 To FrmDessin1.PictureDessin.ScaleWidth - 3
pixval = FrmDessin1.PictureDessin.Point(y+ CInt(Rnd * 10), x + CInt(Rnd * 10))
red_val = "&h" & Mid$(CStr(Hex(pixval)), 5, 2)
green_val = "&h" & Mid$(CStr(Hex(pixval)), 3, 2)
blue_val = "&h" & Mid$(CStr(Hex(pixval)), 1, 2)
If red_val = "&h" Then red_val = "&h0"
If green_val = "&h" Then green_val = "&h0"
If blue_val = "&h" Then blue_val = "&h0"
FrmDessin1.PictureDessin.PSet (y, x), RGB(red_val, green_val, blue_val)
Next
Next
Now 1st when I used it, it worked fine but....I did something later
and now my Application won't compile. The error said that the variable x and y were not defined.
could someone tell me what could I have done wrong and how to
make it work again?
Waiting in the shadow...learning and learning....perfectionning my programming skill....I'll see the fall of Bill Gates....and soon enought....HE WILL SEE MY RISING AND I WILL BE HIS BOSS.....and I will RULE THE WORLD!!! MUHAHAHA........(sorry sometime it happen to me.... if it happen again, don't mind me!!!)
-
Jul 14th, 2002, 11:52 PM
#2
The picture isn't missing
i thought it would have been pretty obvious.....
put this at the top of the sub
Dim x as long
dim y as long
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jul 14th, 2002, 11:53 PM
#3
PowerPoster
Try using
Next Y
Next X
If thats not the problem then you should dim the variables
Dim X as Interger, Y As integer
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Jul 15th, 2002, 12:31 AM
#4
Thread Starter
Member
to BuggyProgrammer
It's the first thing I did but if I do that it ask me the same thing with pixval and the other's
(the code work on another program I made and the original code doesn't need to dim any variable)
I'll put a demo to show you that it work without any dimed variable
I think elsewhere on my program code I did something that stopped the filther from working...but I don't know what....do you know what could I have done wrong?
Waiting in the shadow...learning and learning....perfectionning my programming skill....I'll see the fall of Bill Gates....and soon enought....HE WILL SEE MY RISING AND I WILL BE HIS BOSS.....and I will RULE THE WORLD!!! MUHAHAHA........(sorry sometime it happen to me.... if it happen again, don't mind me!!!)
-
Jul 15th, 2002, 12:35 AM
#5
The picture isn't missing
check at the very top of you form and see if Option Explicit is there
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jul 15th, 2002, 12:55 AM
#6
Thread Starter
Member
thank's
I found 2 problems:
-the Option explicit was changed of place somehow
-a piece of code that was using the same variable
thank's now it work again
Waiting in the shadow...learning and learning....perfectionning my programming skill....I'll see the fall of Bill Gates....and soon enought....HE WILL SEE MY RISING AND I WILL BE HIS BOSS.....and I will RULE THE WORLD!!! MUHAHAHA........(sorry sometime it happen to me.... if it happen again, don't mind me!!!)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|