This is my code so far
        For intArrayCheck = 0 To 16
            foo = sender.name
            If foo = strShipsLocationArray(intArrayCheck) Then
                MessageBox.Show("You got a ship down!")
                sender.backcolor = Color.Red
            End If
        Next
What I want the code to do is if foo is not equal to any strings in strSh开发者_C百科ipLocationsArray then
        sender.backcolor = Color.Blue
How do I do this?
Thank you for any help
Set it to blue before entering the loop. So if will change If foo=strShipsLocationArray(intArrayCheck), otherwise it will stay blue
Always set it to blue before your loop. That way if it is never set to red during the loop, it'll still be blue afterwards, so the final result will always be as required.
If setting that property has an immediate side effect, use a temporary variable and assign it to sender.backcolor after the loop finishes.
                                        
                                        
                                        
                                        
                                        
                                        
                                        
                                        
 加载中,请稍侯......
      
精彩评论