Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Incrementing a string field
Message
From
19/12/2010 10:49:01
 
 
To
19/12/2010 09:45:37
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01493214
Message ID:
01493287
Views:
48
>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.
Previous
Reply
Map
View

Click here to load this message in the networking platform