0

I want to get the full name of an object declared. The following method do not give me what I want:

Dim objTemp As System.Int32

Debug.Print(TypeName(objTemp))

The result is Integer, I want to have is as declared System.Int32

Daniel
  • 10,641
  • 12
  • 47
  • 85
Werries-SA
  • 11
  • 3
  • 3
    Firstly, you don't declare objects. You declare variables and assign objects to them. – jmcilhinney May 21 '19 at 13:27
  • Console.WriteLine(objTemp.GetType()) –  May 21 '19 at 13:27
  • 1
    Possible duplicate of [Get type name without full namespace](https://stackoverflow.com/questions/3396300/get-type-name-without-full-namespace) – Trevor May 21 '19 at 17:13
  • 1
    TypeName() is a vb.net-specific helper function that speaks with a basic lisp. It behaves the way it did in previous Basic versions, [like VBA](https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/typename-function). – Hans Passant May 21 '19 at 18:22

2 Answers2

1

GetType() returns only 1 level when GetType().FullName gives you the entire mapping including the assembly.

Dim objTemp As System.Int32

Debug.Print(objTemp.GetType().FullName)
0

Use GetType.ToString

objTemp.GetType.ToString
Mr. Tripodi
  • 809
  • 1
  • 6
  • 7