Q:

GetType - VB.NET - Code is causing syntax error

Imports System.Windows.Forms

Module Module1

    Sub Main()
        Dim TextBox1 As New TextBox
        Dim TextBox2 As New TextBox
        If (GetType(TextBox1).Equals(GetType(TextBox2))) Then ' Error Here
            Console.WriteLine("They are equal.")
        End If
    End Sub

End Module

I know, GetType for an object returns the Type of it. But here GetType(TextBox1) causes an error. I need to re-write this logic:
If (GetType(TextBox1).Equals(GetType(TextBox2))) Then ' Error Here
    Console.WriteLine("They are equal.")
End If

I wrote like this:
If TextBox1.GetType().FullName.Equals(TextBox2.GetType().FullName) Then ' Works fine
    Console.WriteLine("They are equal.")
End If

Can you re-write the logic ?
If (GetType(TextBox1).Equals(GetType(TextBox2))) Then ' Error Here
    Console.WriteLine("They are equal.")
End If

A:

Basically, GetType() operator expects a typename, not an object. To get a type of the object, use its GetType() method. IOW, in your code you can:
GetType(TextBox)

but can't:
GetType(TextBox1) ' Won't compile!

and have to:
TextBox1.GetType()

So, the error is expected, your solution is fine and your failed re-write attempt is an error, as expected.
For more detailed explanation, check:
https://msdn.microsoft.com/en-us/library/tay4kywk.aspx

