2 Replies - 531 Views - Last Post: 20 January 2009 - 08:30 PM Rate Topic: -----

#1 sam.adams61  Icon User is offline

  • D.I.C Regular

Reputation: 12
  • View blog
  • Posts: 283
  • Joined: 14-July 08

Data type problem

Post icon  Posted 20 January 2009 - 04:28 PM

Could someone please explain why the line "The number " & Cstr(anyThing) & " is type " & anyThing.GetType() shows that the & Operator is not defined for types 'String' and System.types? I've tried a number of variations for this line, but always encounter a problem with the 'anyThing.GetType' statement, from the above aforementioned, to 'end of statement expected.' As always, the helpful advice from this community will be greatly appreciated. Many thanks, for now. ;)

  Public Class Form1

	Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShow.Click
		Dim anyThing As Object
		anyThing = 7
		txtIndex.Text = "The number " & CStr(anyThing) & " is type  " & anyThing.GetType()
	End Sub
End Class 


Is This A Good Question/Topic? 0
  • +

Replies To: Data type problem

#2 dbasnett  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 110
  • View blog
  • Posts: 609
  • Joined: 01-October 08

Re: Data type problem

Posted 20 January 2009 - 05:55 PM

Dim obj As New Object
Debug.WriteLine("This " & Convert.ToString(obj) & " " & obj.GetType.ToString)
Was This Post Helpful? 1
  • +
  • -

#3 sam.adams61  Icon User is offline

  • D.I.C Regular

Reputation: 12
  • View blog
  • Posts: 283
  • Joined: 14-July 08

Re: Data type problem

Posted 20 January 2009 - 08:30 PM

Many, many thanks my VB friend. As we say in Ireland, 'May your giving hand never fall off!' ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1