hum.. that don't works. <BR><BR>But i've try "int i = Convert.ToInt32(textbox.Text);"<BR>and it works.<BR><BR>Now, how can I do the same thing with a float? The Convert. does'nt allow .ToFloat... Someone?
Type casting can only be implicit when no data will be lost. Data can be explicitly cast only if there is enough ram on the stack or heap to support the cast. Remembering that longs can hold considerably more than an int. Hence C# will not allow the cast.
Yeh right! So I was trying to cast a long (pointer) to an int using an implicit cast. Therefore, in that case only an explicit cast (Convert.ToInt32(...)) would do. So, am I right in saying that - in C# at least - the correct way to read a TextBox value into an int would be:<BR><BR>int myInt = 0 ;<BR>Try<BR> myInt = Convert.ToInt32( myTextBox.Text ) ;<BR>Catch ex As System.OverflowException<BR> // number too big or small<BR>End Try<BR><BR><BR>Mark-up ASPMessageboard posts here <BR>http://www.markitup.com/Forum/ASPMB.asp