ورود

View Full Version : سوال: Object reference not set to an instance of an object



h_jamshidi
پنج شنبه 26 بهمن 1391, 02:03 صبح
سلام دوستان
یک گزارش یک صفه ای با کریستال ریپورت 13 در vs2010 با C#‎‎‎‎‎‎‎win ساختم که اجزا گزارش توسط پارامتر به فید های پارامتریک موجود در گزارش ارسال میشه تا اینجا کار مشکلی نیست و گزارش بدون اشکال نمایش داده میشه اما در بعضی مواقع که این بعضی مواقع گاهی هم اولین اجرا است با خطا زیر مواجه میشه
لازم به توضیح است که پارامتر هایی که ارسال می شود را ثابت در نظر گرفتم تا از ورودی مطمئن باشم ولی به صورت رندوم خطا ظاهر میشه

با تشکر




System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=CrystalDecisions.Windows.Forms
StackTrace:
at CrystalDecisions.Windows.Forms.PageControl.OnMouse Move(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at CrystalDecisions.Windows.Forms.PageControl.WndProc (Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at PortalConfirmationWin.Program.Main() in O:\ProfessionalProjects\VS2010Projects\PortalConfi rmationWin\Program.cs:line 45
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:








See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at CrystalDecisions.Windows.Forms.PageControl.OnMouse Move(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at CrystalDecisions.Windows.Forms.PageControl.WndProc (Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)





CRConfirmDocument rptDoc = new CRConfirmDocument();
rptDoc.Load();
crystalReportViewer1.Enabled = true;
ParameterFields paramFields = new ParameterFields();
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

paramField = new ParameterField();
paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "@doc_strFootertxt_Document";
paramDiscreteValue.Value = "متن آزمایشی";
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
crystalReportViewer1.ParameterFieldInfo = paramFields;
crystalReportViewer1.ReportSource = rptDoc;

swallow.pa
پنج شنبه 10 اسفند 1391, 12:57 عصر
اين متن خطا روي هر چيزي كه ايستاده يعني اون ابجكت يا رفرنس موجود نيست اون خط رو بررسي كن