foreach (object item in listBox1.SelectedItems) { string curItem = item.ToString(); var parts = curItem.Split(\"{}XY=, \".ToCharArray(), StringSplitOptions.Remov
Consider using regular expressions.
var match = Regex.Match(val, @"([-+]?[0-9]*\.?[0-9]+)"); if (match.Success) xCoord = Convert.ToSingle(match.Groups[1].Value);