Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 31st, 2005, 07:08 PM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default WHY DOESNT THIS WORK

Dim pixelColor As Color
        Dim x As Integer
        Dim y As Integer

        Do
            pixelColor = myBitmap.GetPixel(x, y)
            Label1.BackColor = pixelColor
            If pixelColor = Color.Red Then
                MsgBox("YOU FOUND COLOR AT " & x & " " & y & "!")
                Exit Do
            End If
            x += 1
            If x = myBitmap.Width Then
                x = 0
                y += 1
            End If
        Loop Until y = myBitmap.Height
the loop works very well except the code has a problem with the
If pixelColor = Color.Red Then
                MsgBox("YOU FOUND COLOR AT " & x & " " & y & "!")
                Exit Do
            End If
it has trouble with the first line. I cant remember what i can use to check wheter a color matches a color. EX
IF color1 = color2 then
dosomthing
end if
Any help is wonderful help

~~~~~~~~~~~~~~~~~~~~~
I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter.
__________________
~~~~~~~~~~~~~~~~~~~~~
I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter. I\'m sorry for having a rude signature Peter.
Reply With Quote
  #2 (permalink)  
Old August 1st, 2005, 12:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

If pixelColor.Equals(Color.Red) Then
    MsgBox("YOU FOUND COLOR AT " & x & " " & y & "!")
    Exit Do
End If
Reply With Quote
  #3 (permalink)  
Old August 1st, 2005, 01:21 PM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok i tried that like this
Dim pic as new bitmap("C:\test.bmp")
'test.bmp is a 50x50 full black picture
DIm pixelcolor as color
pixelcolor = pic.getpixel(10,10)
'should be black
If pixelcolor.equals(color.black) then
  messagebox.show("YAY")
End If


~~~~~~~~~~~~~~~~~~~~~
I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter.
Reply With Quote
  #4 (permalink)  
Old August 1st, 2005, 04:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

You are probably better off to use the RGB value than a named color. Try this, it worked for me:

If pixelcolor.Equals(Color.FromArgb(0, 0, 0)) Then
  MessageBox.Show("YAY")
End If
Reply With Quote
  #5 (permalink)  
Old August 1st, 2005, 04:53 PM
Authorized User
 
Join Date: May 2005
Location: , , .
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

TY TY TY this forum is the best place on the net for code q's!!! IT WOOORRRRKKSS thanks again.

Wrox Rocks (say that 10x fast)


~~~~~~~~~~~~~~~~~~~~~
I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter. I'm sorry for having a rude signature Peter.
Reply With Quote
  #6 (permalink)  
Old August 1st, 2005, 11:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Your welcome. Glad I could help.

J
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Membership and Roles doesnt work Baby_programmer ASP.NET 2.0 Professional 2 July 29th, 2008 09:41 AM
c:out doesnt work tllcll JSP Basics 1 November 1st, 2007 03:15 AM
xsl:key doesnt work cristtiah XSLT 11 May 24th, 2006 09:57 AM
Button doesnt work help john111 Java GUI 4 March 21st, 2006 05:22 PM
ContainsValue doesnt work demitry Generics 1 November 21st, 2005 05:29 PM



All times are GMT -4. The time now is 09:02 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.