Im getting an "unknown selection" error on this code. Can anyone help me. I don't know what is wrong. My two text boxes both have English selected. blankl and blanlkw have both been initialized as decimals.

if (bunitsCB.Text == "English")
                {                
                    switch (dieunitsCB.Text)
                    {
                        case "English":
                            dielTB.Text = Convert.ToString(blankl + Convert.ToDecimal(24));
                            diewTB.Text = Convert.ToString(blankw + Convert.ToDecimal(24)); break;
                        case "Metric":
                            dielTB.Text = Convert.ToString(Math.Round((blankl * Convert.ToDecimal(25.4)), 0) + Convert.ToDecimal(588));
                            diewTB.Text = Convert.ToString(Math.Round((blankw * Convert.ToDecimal(25.4)), 0) + Convert.ToDecimal(588)); break;
                        default:
                            throw new Exception("Unknown selection");
                    }
                 }
                else
                {
                    switch (dieunitsCB.Text)
                    {
                        case "English":
                            dielTB.Text = Convert.ToString(Math.Round((blankl / Convert.ToDecimal(25.4)), 0) + Convert.ToDecimal(24));
                            diewTB.Text = Convert.ToString(Math.Round((blankw / Convert.ToDecimal(25.4)), 0) + Convert.ToDecimal(24)); break;                           
                        case "Metric":                            
                            dielTB.Text = Convert.ToString(blankl + Convert.ToDecimal(588));
                            diewTB.Text = Convert.ToString(blankw + Convert.ToDecimal(588)); break;
                        default:
                            throw new Exception("Unknown selection");
                    }
                }

What types are blankl and blankw ?
As integers, I do not get any errors, or the thrown error.

Side comment - with 18 post under your belt, you should have known enough to wrap your code in code tags.

[code] ... your code here ... [/code] at least, but for this forum, preferably [code=c#] ... [/code]

I rebuilt the solution and it worked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.