السلام عليكم
قمت بعمل هذه الفئه التي هي ترث :
System.Web.UI.WebControls.Image
Imports System.Web.UI.WebControls
Public Class SmartImage
Inherits Image
Public Overrides Property ImageUrl() As String
Get
Return MyBase.ImageUrl
End Get
Set(ByVal value As String)
If Not value.EndsWith("/") Then
MyBase.ImageUrl = value
Else
Me.Visible = False
End If
End Set
End Property
End Class
Imports Microsoft.VisualBasic
و الغريب ف الأمر أنه عندما أريد التحويل من الImage إلي SmartImage لا يستطيع المترجم التحويل :
image1 = CType ( image1, SmartImage)
حيث أن ال image1 هي صوره ملقاه علىال form
أرجو المساعده