Here's something that's important to know—if you want to know if two objects are really the same object, you should use the Is keyword instead of the standard comparison operators. If the two objects you're checking are the same object, Is returns True. Here's an example we saw in Chapter 6, where I'm checking which button of several has been clicked; the clicked button is passed to us in the sender argument:
Private Sub Button_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) If sender Is Button1 Then TextBox1.Text = "You clicked button 1" End If If sender Is Button2 Then TextBox1.Text = "You clicked button 2" End If If sender Is Button3 Then TextBox1.Text = "You clicked button 3" End If End Sub