int? i = Convert.ToInt32(orderqty.Text); int? counts = !string.IsNullOrEmpty(orderqty.Text) ? i : (int?)null; int? i1 = Convert.ToInt32(yarncounts.Text); int? counts1 = !string.IsNullOrEmpty(yarncounts.Text) ? i1 :(int?)null;
int? counts1 = string.IsNullOrEmpty(yarncounts.Text) ? (int?)null : int.Parse(yarncounts.Text);
int? counts1 = (string.IsNullOrEmpty(yarncounts.Text) ? (int?)null : Convert.ToInt32(yarncounts.Text);
int? counts1 = null; int i1; if (int.TryParse(yarncounts.Text, out i1)) { counts1 = i1; } else { // here you can perform any additional error handling/reporting (but you don't HAVE to!) }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)