Vb. NET to determine whether two objects are the same

Source: Internet
Author: User
Determine if two objects are the same

Set a Boolean expression to test the two objects.
In a test expression, use the is operator to take two objects as operands.
is returns True if two objects point to the same class of instances.

Determine if two objects are different

Sometimes, you want to perform an operation on two objects, and are not suitable for combining not and is, such as If not Obj1 is obj2. In this case, you can use the IsNot operator.
Set a Boolean expression to test the two objects.
In a test expression, use the IsNot operator to take two objects as operands. IsNot returns True if two objects point to a different class instance.

    Private Sub Radiobutton1_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Radiobutton1.click, Rad Iobutton4.click, Radiobutton3.click, Radiobutton2.click
        Dim button as RadioButton = CType (sender, RadioButton)

        If Sender is RadioButton1 Then
            MsgBox ("OK") end
        If End
    Sub


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.