Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# Type Cast Question
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01079396
Message ID:
01079403
Vues:
22
Hi, Kevin.

>I'm trying to cast a textbox value to int;
>Can someone help me out please?
>
>
>// Define the port number variable
>int iPortNo = 0;
>
>// Read in the port number from the textbox
>iPortNo = (int)txtPort.Text;
>
You can use Einar's one or a conversion:

>
>// Define the port number variable
>int iPortNo = 0;
>
>// Read in the port number from the textbox
>iPortNo = Convert.ToInt32( txtPort.Text );
>
Regards,
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform