"Input string was not in a correct format" when setting a NumericUpDown value
<p>I don't understand why this doesn't work. </p>

<p>I am using a file to set bunch of in my program. I am reading the content of a file by using separators. My text file looks like this: <code>The Message$1$5001&amp;5002&amp;5003</code></p>

<p>When I am trying to read a value of a numeric values in my file I am getting error: <code>Input string was not in a correct format.</code> on line: <code>nudInterval.Value = decimal.Parse(setting);</code></p>

<p>This is how I do it:</p>

<pre><code>if (!lastUsed.EmptyFile())
{
    string[] allSettings = lastUsed.Text.Split('$');
    int settingCount = 0;

    foreach (string setting in allSettings)
    {
        settingCount++;

        if (settingCount == 1)
        {
            txtText.Text = setting;
        }
        else if (settingCount == 2)
        {
            if (setting == "0") tbType.SelectedTab = tbInterval;
            else tbType.SelectedTab = tbRange;
        }
        else if (settingCount == 3)
        {
            nudInterval.Value = decimal.Parse(setting);
        }
        else if (settingCount == 4)
        {
            nudMin.Value = decimal.Parse(setting);
        }
        else if (settingCount == 5)
        {
            nudMax.Value = decimal.Parse(setting);
        }
    }
}
</code></pre>
