Server Error in '/' Application.

Length cannot be less than zero.
Parameter name: length

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length

Source Error:


Line 77:         c1 = DropDownList1.SelectedValue.IndexOf('(');
Line 78:         c2 = DropDownList1.SelectedValue.IndexOf(')');
Line 79:         Label4.Text = DropDownList1.SelectedValue.Substring(c1 + 1, c2 - c1 - 1);
Line 80:         if (odcu[DropDownList1.SelectedIndex].nofans == 1)
Line 81:             DropDownList3.Enabled = false;

Source File: c:\Boxload\ODCUBOM.aspx.cs    Line: 79

Stack Trace:


[ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length]
   System.String.Substring(Int32 startIndex, Int32 length) +13025971
   ODCUBOM.DropDownList_SelectedIndexChanged(Object sender, EventArgs e) in c:\Boxload\ODCUBOM.aspx.cs:79
   ODCUBOM.Page_Load(Object sender, EventArgs e) in c:\Boxload\ODCUBOM.aspx.cs:18
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3930.0