Jarod,
You can make it one line in C#, but it won't be as elegant:
// Increment the text of the label by adding one to the number that is on
the label.
lbl.Text = (++Convert.ToInt32(lbl.Text)).ToString();
The reason that works in VB is because it will perform automatic type
conversion. In reality, VB is converting the text to an integer,
incrementing it by 1, then converting back to a string, and then assigning
it back to the property.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Jarod" <Ja***@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
Hey
I have very simple problem... I have label let's say it's lbl. So I need
it
to display a counter:
int counter = Convert.ToInt32(lbl.Text) +1
bl.Text = counter;
In VB.Net I made it like this :
lbl.Text +=1
is there any way, to make it one line in C# ?
Jarod