470,864 Members | 1,989 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,864 developers. It's quick & easy.

textBox question

I'm using C# and building a basic windows application, but I can't for the
life of me figure out how to get an integer/long value from a text box. I
have written a function which converts a string to an int/long but I feel
like there should be an easier way of doing this. Either via a built in
string to int conversion or just using the textBoxes.

Thanks for any help.

~Justin
Mar 2 '06 #1
2 885
int.Parse(textBox.Text) ??

And handle errors accordingly...
"Justin Naidl" <jn***@lsol.net> wrote in message
news:44***********************@news.tm.net...
I'm using C# and building a basic windows application, but I can't for the
life of me figure out how to get an integer/long value from a text box. I
have written a function which converts a string to an int/long but I feel
like there should be an easier way of doing this. Either via a built in
string to int conversion or just using the textBoxes.

Thanks for any help.

~Justin

Mar 2 '06 #2
And, remember that Textboxes, by their very nature, only hold string data.
Taking that data out and treating like anything but a string would
necessitate a cast.
"Gabriel Magaña" <no*****@no-spam.com> wrote in message
news:eF*************@TK2MSFTNGP15.phx.gbl...
int.Parse(textBox.Text) ??

And handle errors accordingly...
"Justin Naidl" <jn***@lsol.net> wrote in message
news:44***********************@news.tm.net...
I'm using C# and building a basic windows application, but I can't for
the life of me figure out how to get an integer/long value from a text
box. I have written a function which converts a string to an int/long
but I feel like there should be an easier way of doing this. Either via
a built in string to int conversion or just using the textBoxes.

Thanks for any help.

~Justin


Mar 3 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Henry | last post: by
1 post views Thread by rn5a | last post: by
10 posts views Thread by garyusenet | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.