Converting a String to a Short

Viewed 44964

Current code:

short s;

s = short.Parse(this.txtFields3.Text);

I've gone through with debugging, and can confirm that the txtField3.Text returns an actual value from the form.

Also tried:

s = short.Parse(this.txtFields3.Text, CultureInfo.InvariantCulture);

and,

s = Convert.toInt16(this.textFields3.Text);    

EDIT: The value of the variable I'm trying to put into 's' here is "EMS".

2 Answers
Related