有一个按钮"查询"一个 gridcontrol 显示数据  焦点到 "查询" 上按 回车 不送开出了异常---  A
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 DevExpress.Data.VisibleListSourceRowCollection.get_Count()
   at DevExpress.Data.DataController.get_VisibleListSourceRowCount()
   at DevExpress.Data.DataController.IsControllerRowValid(Int32 controllerRow)
   at DevExpress.Data.CurrencyDataController.IsControllerRowValid(Int32 controllerRow)
   at DevExpress.Data.DataController.IsControllerCellValid(Int32 controllerRow, Int32 column)
   at DevExpress.Data.DataController.GetRowValue(Int32 controllerRow, Int32 column, OperationCompleted[] completed)
   at DevExpress.Data.BaseListSourceDataController.GetRowValue(Int32 controllerRow, Int32 column, OperationCompleted[] completed)
   at DevExpress.XtraGrid.Views.Base.ColumnView.GetRowCellValue(Int32 rowHandle, GridColumn column)
   at DevExpress.XtraGrid.Views.Grid.GridView.GetRowCellValue(Int32 rowHandle, GridColumn column)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcRowCellDrawInfo(GridDataRowInfo ri, GridColumnInfoArgs ci, GridCellInfo cell, GridColumnInfoArgs nextColumn, Boolean calcEditInfo)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcRowCellsDrawInfo(GridDataRowInfo ri, GridColumnsInfo columnsInfo)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcDataRow(GridDataRowInfo ri, GridRow row, GridRow nextRow)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcRowsDrawInfo()
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcGridInfo()
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.Calc(Graphics g, Rectangle bounds)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.FullRecalcScroll(Graphics g, Rectangle bounds)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcAfterVertScrollCore(Graphics g, Rectangle bounds, Boolean useCache)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcAfterVertScroll(Graphics g, Rectangle bounds, Boolean useCache)
   at DevExpress.XtraGrid.Views.Grid.GridView.RefreshRows(Boolean useCache, Boolean afterScroll)
   at DevExpress.XtraGrid.Views.Grid.GridView.CalculateDataCore()
   at DevExpress.XtraGrid.Views.Grid.GridView.CalculateData()
   at DevExpress.XtraGrid.Views.Base.BaseView.CheckViewInfo()
   at DevExpress.XtraGrid.Views.Base.BaseView.Draw(GraphicsCache e)
   at DevExpress.XtraGrid.GridControl.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at DevExpress.XtraEditors.Container.EditorContainer.WndProc(Message& m)
   at DevExpress.XtraGrid.GridControl.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3623 (GDR.050727-3600)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
--  B
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 DevExpress.Skins.SkinElementPainter.DrawImageStretch(SkinElementInfo info, Image image, Rectangle imageBounds, Rectangle screenBounds)
   at DevExpress.Skins.SkinElementPainter.DrawImage(SkinElementInfo info, Image image, Rectangle imageBounds, Rectangle screenBounds, SkinImageStretch stretch)
   at DevExpress.Skins.SkinElementPainter.DrawImageStretchTile(SkinElementInfo info, SkinPaddingEdges paddingEdgesData, Image image, Rectangle imageBounds, Rectangle destBounds, SkinImageStretch stretch)
   at DevExpress.Skins.SkinElementPainter.DrawSkinImage(SkinElementInfo elementInfo, SkinImage skinImage)
   at DevExpress.Skins.SkinElementPainter.DrawObject(ObjectInfoArgs e)
   at DevExpress.Utils.Drawing.ObjectPainter.DrawObject(GraphicsCache cache, ObjectPainter painter, ObjectInfoArgs e)
   at DevExpress.Utils.Drawing.RotateObjectPaintHelper.DrawRotated(GraphicsCache cache, ObjectInfoArgs info, ObjectPainter painter, RotateFlipType rotate, Boolean alwaysCreate)
   at DevExpress.Utils.Drawing.RotateObjectPaintHelper.DrawRotated(GraphicsCache cache, ObjectInfoArgs info, ObjectPainter painter, RotateFlipType rotate)
   at DevExpress.XtraEditors.Drawing.EditorButtonPainter.DrawButton(ObjectInfoArgs e)
   at DevExpress.XtraEditors.Drawing.EditorButtonPainter.DrawObject(ObjectInfoArgs e)
   at DevExpress.XtraEditors.Drawing.SkinEditorButtonPainter.DrawObject(ObjectInfoArgs e)
   at DevExpress.XtraEditors.Drawing.ButtonEditPainter.DrawButton(ButtonEditViewInfo viewInfo, EditorButtonObjectInfoArgs info)
   at DevExpress.XtraEditors.Drawing.ButtonEditPainter.DrawButtons(ControlGraphicsInfoArgs info, EditorButtonObjectCollection collection, Boolean drawNormalDisabled)
   at DevExpress.XtraEditors.Drawing.ButtonEditPainter.DrawButtons(ControlGraphicsInfoArgs info)
   at DevExpress.XtraEditors.Drawing.ButtonEditPainter.DrawContent(ControlGraphicsInfoArgs info)
   at DevExpress.XtraEditors.Drawing.BaseControlPainter.Draw(ControlGraphicsInfoArgs info)
   at DevExpress.XtraEditors.Drawing.BaseEditPainter.Draw(ControlGraphicsInfoArgs info)
   at DevExpress.XtraEditors.BaseControl.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
   at DevExpress.XtraEditors.TextEdit.WndProc(Message& msg)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3623 (GDR.050727-3600)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
--  B
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 DevExpress.Data.GroupRowInfoCollection.GetGroupRowInfoByControllerRowHandle(Int32 controllerRowHandle)
   at DevExpress.Data.DataController.IsRowExpanded(Int32 groupRowHandle)
   at DevExpress.XtraGrid.Views.Grid.GridView.GetRowExpanded(Int32 rowHandle)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.GetRowFooterCount(Int32 rowHandle, Int32 rowVisibleIndex)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.GetTotalFooterRowHeight(Int32 rowHandle, Int32 rowVisibleIndex)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcTotalRowHeight(Graphics g, Int32 rowHandle, Int32 rowVisibleIndex, Int32 level)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.LoadRowsCore(GridRowsLoadInfo e)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.LoadRows(GridRowsLoadInfo e)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcAfterVertScrollCore(Graphics g, Rectangle bounds, Boolean useCache)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcAfterVertScroll(Graphics g, Rectangle bounds, Boolean useCache)
   at DevExpress.XtraGrid.Views.Grid.GridView.RefreshRows(Boolean useCache, Boolean afterScroll)
   at DevExpress.XtraGrid.Views.Grid.GridView.CalculateDataCore()
   at DevExpress.XtraGrid.Views.Grid.GridView.CalculateData()
   at DevExpress.XtraGrid.Views.Base.BaseView.CheckViewInfo()
   at DevExpress.XtraGrid.Views.Base.BaseView.Draw(GraphicsCache e)
   at DevExpress.XtraGrid.GridControl.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at DevExpress.XtraEditors.Container.EditorContainer.WndProc(Message& m)
   at DevExpress.XtraGrid.GridControl.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3623 (GDR.050727-3600)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------请教高手解释下

解决方案 »

  1.   

    第三方的商业控件
    用别人的 不知道 出问题的原因很正常你去 democenter去看官方怎么用的
     
      

  2.   

    异常说的很清楚了
    NullReferenceException
    未将对象应用到实例错误
    你代码的问题 和控件沒关系吧
      

  3.   

    你的按钮控件执行的什么代码啊.只是将数据查询出来然后绑定到gridControl的datasource上的吗
      

  4.   

     按钮控件(第三方控件)  会变成红X  gridview 也会红X
      

  5.   

    报错信息的标题写的很清楚:NullReferenceException(未将对象设置到引用),跟你按住回车不松手有关系吗?