Hi Everyone.
I am exporting data in excel sheet.when i clik export button then following exception is arises and they ask "quit" or "continue".when i click continue then successfully datas are exporting in excel sheet,but how can i handel this exception.
PLEASE HELP.Its very urgent for me.
Thanks a lot inadvance.
"Index and length must refer to a location within the string. Parameter name: length"
System.ArgumentOutOfRangeException was unhandled
Message="Index and length must refer to a location within the string.\r\nParameter name: length"
Source="mscorlib"
ParamName="length"
StackTrace:
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.String.Substring(Int32 startIndex, Int32 length)
at ICDProject.frmDriverPayment.<newreportquery>b__6(clsExtensionOfPortTictsCharges order) in F:\Project\NewICDProject\ICDProject\ICDProject\frmDriverPayment.cs:line 1105
at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.GroupedEnumerable`3.GetEnumerator()
at System.Linq.Enumerable.<SelectIterator>d__d`2.MoveNext()
at ICDProject.frmDriverPayment.NewReportQuery() in F:\Project\NewICDProject\ICDProject\ICDProject\frmDriverPayment.cs:line 1120
at ICDProject.frmDriverPayment.btnViewInGrid_Click(Object sender, EventArgs e) in F:\Project\NewICDProject\ICDProject\ICDProject\frmDriverPayment.cs:line 268
at ICDProject.frmDriverPayment.btnExportInExcel_Click(Object sender, EventArgs e) in F:\Project\NewICDProject\ICDProject\ICDProject\frmDriverPayment.cs:line 647
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ICDProject.Program.Main() in F:\Project\NewICDProject\ICDProject\ICDProject\Program.cs:line 27
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: