But it doesn't return zero for an EMPTY string, like from a textbox.
For intstance...
Convert.ToInt32(textBox1.Text).ToString()
// rets emptystring if empty
Zeke
But it doesn't return zero for an EMPTY string, like from a textbox.
For intstance...
Convert.ToInt32(textBox1.Text).ToString()
// rets emptystring if empty
Austin,
I've been looking for a way, in these cases, to eliminate
an "if", *and* the use of:
int x = Convert.ToInt32(
(textBox1.Text == "" ? "0" : textBox1.Text));
It's long and tedious coding but it woiks. The compiler
(or control) s/b smarter than that.
Matt
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.