Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can this be interpreted as a bug?
Message
From
30/05/2006 13:46:16
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
30/05/2006 10:22:21
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01125597
Message ID:
01125950
Views:
36
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform