Connecting Tech Pros Worldwide Forums | Help | Site Map

textBox question

Justin Naidl
Guest
 
Posts: n/a
#1: Mar 2 '06
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



Gabriel Magaņa
Guest
 
Posts: n/a
#2: Mar 2 '06

re: textBox question


int.Parse(textBox.Text) ??

And handle errors accordingly...


"Justin Naidl" <jnadz@lsol.net> wrote in message
news:4407776f$0$25083$4fcefb0e@news.tm.net...[color=blue]
> 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
>[/color]


Scott M.
Guest
 
Posts: n/a
#3: Mar 3 '06

re: textBox question


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-spam@no-spam.com> wrote in message
news:eFXSH1kPGHA.532@TK2MSFTNGP15.phx.gbl...[color=blue]
> int.Parse(textBox.Text) ??
>
> And handle errors accordingly...
>
>
> "Justin Naidl" <jnadz@lsol.net> wrote in message
> news:4407776f$0$25083$4fcefb0e@news.tm.net...[color=green]
>> 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
>>[/color]
>
>[/color]


Closed Thread


Similar .NET Framework bytes