Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can this be interpreted as a bug?
Message
De
29/05/2006 07:31:27
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
28/05/2006 21:31:34
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01125597
Message ID:
01125636
Vues:
18
>I have an image map control on the form. The following condition is evaluated to true:
>
>
>            Dim loControl As System.Web.UI.Control = New System.Web.UI.Control
>            Dim loControlImage As System.Web.UI.WebControls.Image
>            Dim loControlImageMap As System.Web.UI.WebControls.ImageMap
>
>            For lnCounter = 1 To oApp.ParmCnt(tcID)
>                lcControl = oApp.GetParm(tcID, lnCounter)
>                loControl = oApp.oPage.FindControl(lcControl)
>
>                ' If the control is an image
>                If TypeOf loControl Is System.Web.UI.WebControls.Image Then
>                    loControlImage = CType(loControl, System.Web.UI.WebControls.Image)
>                    loControlImage.ImageUrl = oApp.cLanguage + "/" + loControlImage.ImageUrl
>                    oApp.AddJavascriptMessage("we should not be here " + loControlImage.ID)
>                End If
>
>
>In the message I am showing, it shows in fact that the control is interpreted in this condition. However, the control is ImageMap not Image. But, the compiler takes it as an image and enters in the condition. This is not correct. Is there a way to workaround that bug?

Michel,
That's not a bug. ImageMap inherits from Image (and all objects inherit from object).
System.Web.UI.WebControls.Image
 System.Web.UI.WebControls.ImageMap
That means ImageMap is Image (and it's also of type object).
You can check if it's Image and not ImageMap (and ImageButton which is another in the namespace hierarchy). Or alternatively you can check:
if ( loControl.GetType() == System.Web.UI.WebControls.Image )
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform