Issue with inheritance

F

Fabio

Hi all,
look this code, why the InvalidCastException are raised?
How to workaround it?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim Label2 As New Windows.Forms.Label

Dim Label3 As New New_Label

Label2.Text = "TEST"

Label3 = Label2

End Sub

Public Class New_Label

Inherits Windows.Forms.Label

End Class


Thaks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top