I need to sort in ascending numbers the lines of a richtextbox, which got decimals in the follow format:
I'm trying to sort the lines to obtain an output like:0.00001302 - 283000
0.00001315 - 295800
0.00001328 - 292600
0.00001333 - 7700
0.00001341 - 308500
Ive tried0.00001341 - 308500
0.00001333 - 7700
0.00001328 - 292600
0.00001315 - 295800
0.00001302 - 283000
andCode:RichTextBox1.Lines = RichTextBox1.Lines.OrderBy(Function(x) Decimal.Parse(x)).ToArray
but for both I get the same error:Code:Dim lines() As String = RichTextBox1.Lines Dim value = lines.Select(Function(x) Convert.ToInt32(x)).OrderByDescending(Function(x) x) RichTextBox1.Text = String.Join(Environment.NewLine, value)
Clearly the sorting doesn't like the format of the lines, so how can I make it to do not care about the format and just caring about the decimals? ThanksSystem.FormatException: '"Input string is not in correct format"'




Reply With Quote
