Dear Support,
I am facing similar issue and i am getting this exception before getting Red X.
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Exception: Exception handled in FpSpread.WndProc ---> System.Exception: Exception handled in FpSpread.OnPaint() ---> System.NullReferenceException: Object reference not set to an instance of an object.
at FarPoint.Win.Spread.SpreadView.e(Graphics A_0)
at FarPoint.Win.Spread.SpreadView.g(Graphics A_0)
at FarPoint.Win.Spread.FpSpread.OnPaint(PaintEventArgs e)
--- End of inner exception stack trace ---
at FarPoint.Win.Spread.FpSpread.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 FarPoint.Win.Spread.FpSpread.WndProc(Message& m)
--- End of inner exception stack trace ---
at FarPoint.Win.Spread.FpSpread.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
I am working on a real time application and my grid needs to updates asynchronously since GUI may get freezed at times. It works in sync way like the GUI thread fetching data from database and then binding to grid. But my requirement is that i want to bind data asynchronously to grid.
I am using C#.Net 2005,spwin4_net20-2009, SQL Lite 3.0. Attaching my code snippet for your reference. Expecting good support from you as always. Please revert if you have code snippet for async binding
**************************************************************************************************************************************************************
private void cmdRefresh_Click(object sender, EventArgs e)
{
fpBuy.ShowCell(0, 0, 0, 0, FarPoint.Win.Spread.VerticalPosition.Top, FarPoint.Win.Spread.HorizontalPosition.Left);
fpSell.ShowCell(0, 0, 0, 0, FarPoint.Win.Spread.VerticalPosition.Top, FarPoint.Win.Spread.HorizontalPosition.Left);
cmdRefresh.Enabled = false;
lblErrMsg.Text = "Loading Data...";
string errMsg = string.Empty;
Debug.WriteLine("Refresh on PendingOrder Before PopulatePendingOrder");
GetPendingOrders work = new GetPendingOrders(PopulatePendingOrder);
AsyncCallback CompleteCallBack = new AsyncCallback(ShwPendngOrder);
work.BeginInvoke(ref mobjQuery, ref errMsg, CompleteCallBack, null);
Debug.WriteLine("Refresh on PendingOrder call completed PopulatePendingOrder");
}
public Boolean PopulatePendingOrder(ref clsClientQueries objQuery, ref string msg)
{
msg = "";
try
{
Debug.WriteLine("Entry PopulatePendingOrders");
mobjQuery = objQuery;
mobjQuery.GetPartQueries();
if (mobjQuery.BuySellInd == clsConstantsEnums.gstrConstBuy)
{
//only buy
mobjQuery.ShowResults(mobjQuery.BuySellInd);
}
else if (mobjQuery.BuySellInd == clsConstantsEnums.gstrConstSell)
{
//only sell
mobjQuery.ShowResults(mobjQuery.BuySellInd);
}
else
{
mobjQuery.ShowResults(clsConstantsEnums.gstrConstBuy);
mobjQuery.ShowResults(clsConstantsEnums.gstrConstSell);
}
Debug.WriteLine("exitting PopulatePendingOrders");
if (mobjQuery.BuyPendOrd.Count == 0 && mobjQuery.SellPendOrd.Count == 0)
{
msg = "No Data Found";
return false;
}
else
{
return true;
}
}
catch (Exception ex)
{
clsBALCommon.gobjclsFunction.LogInformation(clsConstantsEnums.EnumLogFOR.LOGTWS, "frmPendingOrders-PopulatePendingOrder", string.Empty, ex, string.Empty, clsConstantsEnums.EnumCriticality.Critical, clsConstantsEnums.EnumRespOutputColor.Red, string.Empty, clsConstantsEnums.EnumRequestType.EXCEPTION);
throw ex;
}
}
public void ShwPendngOrder(IAsyncResult result)
{
string msg = "";
Debug.WriteLine("Callback completed PopulatePendingTrades");
AsyncResult ar = (AsyncResult)result;
GetPendingOrders work = (GetPendingOrders)ar.AsyncDelegate;
Boolean isSuccessful = work.EndInvoke(ref mobjQuery, ref msg, result);
isSucessFull(isSuccessful, msg);
}
public delegate void delNoDataFound(bool isVal, string msg);
public void isSucessFull(bool isVal, string msg)
{
if (isVal == true)
{
OpenPendingOrder();
}
else
{
if (this.InvokeRequired)
{
this.Invoke(new delNoDataFound(isSucessFull), isVal, msg);
return;
}
//this.lblError.Text = msg;
this.lblErrMsg.Text = msg;
}
cmdRefresh.Enabled = true;
}
public delegate void delOpenPendingOrder();
public void OpenPendingOrder()
{
if (this.InvokeRequired)
{
this.Invoke(new delOpenPendingOrder(OpenPendingOrder));
return;
}
Debug.WriteLine("showing PendingOrder");
this.lblErrMsg.Text = string.Empty;
//InitializePendOrder();
ShowPendingOrder();
//gobjPendingOrder.Show();
//this.Hide();
//frmClientQueryClosing();
}
**************************************************************************************************************************************************************
Thanks,
Sanket