Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Incrementing a string field
Message
De
19/12/2010 10:49:01
 
 
À
19/12/2010 09:45:37
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01493214
Message ID:
01493287
Vues:
49
>Thanks, Viv, for pointing me in the right direction.
>I finally got to that step this AM.
>Other restraints in the system limit the number of versions to 10, starting with "A", so I just needed to increment it.
>
>Here's another question:
>
>This works
> private void buttonCreatenewversion_Click(object sender, EventArgs e)
> {
> char c = Convert.ToChar(CurrentVersion);
> c++;
> string newversion = c.ToString();
>
> } // key down
>
>
>This gives me the existing version. Why is that??
>
> private void buttonCreatenewversion_Click(object sender, EventArgs e)
> {
> char c = Convert.ToChar(CurrentVersion);
> string newversion = c++.ToString();
>
> } // key down

Like Bonnie said: use (++c).ToString();
c++ will increment c *after* using the value.
++c will increment c *before* using the value.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform