Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fastest way to scan for textbox controls
Message
 
À
10/12/2012 15:42:03
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01559234
Message ID:
01559263
Vues:
74
This message has been marked as a message which has helped to the initial question of the thread.
J'aime (1)
Use:

if (loControl is TextBox) instead of string conversion. It'll be faster than a string type comparison.

+++ Rick ---



>I would like to verify if this approach is the fastest way to scan for textbox controls in a form:
>
>
>                ' For each control in this form
>                For Each loControl In loHtmlForm.Controls
>
>                    ' If this is a textbox
>                    If loControl.GetType().ToString = "System.Web.UI.WebControls.TextBox" Then
>
>                        ' Assign this control to a textbox variable
>                        loTextbox = loControl
>
>                        ' Add the onkeypress to the textbox
>                        loTextbox.Attributes.Add("onkeypress", "FormKeyPress(event)")
>
>                    End If
>
>                Next
>
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform