Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can this be interpreted as a bug?
Message
De
30/05/2006 13:46:16
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
30/05/2006 10:22:21
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:
01125950
Vues:
35
>>I suggested GetType() not ToString(). ToString() can be overridden and if for any case it's overridden to return something else then it'd break. You might rely on that you'd never override but I think GetType() is the way to go.
>
>Thanks, I adjusted:
>
>
>            For lnCounter = 1 To oApp.ParmCnt(tcID)
>                lcControl = oApp.GetParm(tcID, lnCounter)
>                loControl = oApp.oPage.FindControl(lcControl)
>
>                ' If the control is an image
>                If loControl.GetType().ToString = "System.Web.UI.WebControls.Image" Then
>                    loControlImage = CType(loControl, System.Web.UI.WebControls.Image)
>                    loControlImage.ImageUrl = oApp.cLanguage + "/" + loControlImage.ImageUrl
>                End If
>
>                ' If the control is an imagemap
>                If loControl.GetType().ToString = "System.Web.UI.WebControls.ImageMap" Then
>                    loControlImageMap = CType(loControl, System.Web.UI.WebControls.ImageMap)
>                    loControlImageMap.ImageUrl = oApp.cLanguage + "/" + loControlImageMap.ImageUrl
>                End If
>
>            Next
>
Michel,
It's your code and would work this way 99.9%. It would be better IMHO if you compare type to type (w/o ToString() comparison). In C# it's as easy as:
if ( loControl.GetType() == typeof(System.Web.UI.WebControls.Image) )
However in VB I found it hard to find compatible code:
if ( loControl.GetType().Equals( System.Type.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