Error in ComboboxCellType

Posted by: raccsdl on 8 September 2017, 12:43 pm EST

  • Posted 8 September 2017, 12:43 pm EST

    Hi Scotts.<br><br>I got this error in my project :<br><br>System.NullReferenceException was unhandled<br>  Message="Object reference not set to an instance of an object."<br>  Source="FarPoint.Win.Spread"<br>  StackTrace:<br>       at FarPoint.Win.Spread.FpSpread.WndProc(Message& m)<br>       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)<br>       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)<br>       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)<br>       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)<br>       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)<br>       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)<br>       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)<br>       at System.Windows.Forms.Application.Run(ApplicationContext context)<br>       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()<br>       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()<br>       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)<br>       at EquityResearch.Net.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81<br>       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)<br>       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)<br>       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()<br>       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br>       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)<br>       at System.Threading.ThreadHelper.ThreadStart()<br><br>It happened when the second time I click to combobox in SpreadSheet. The project still run if I didn't run project in bebug mode but when I add break point to debug and it happened.<br><br>This is code which I wrote in event  ComboDropDown:<br>    Private Sub fpUniverse_ComboDropDown(ByVal sender As System.Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles fpUniverse.ComboDropDown<br>        Dim tbl As New DataTable<br>        Try<br>            If e.Column = C_UNIVERSE_DATE Then<br>                CType(e.EditingControl, FarPoint.Win.FpCombo).AcceptsReturn = True<br>                CType(e.EditingControl, FarPoint.Win.FpCombo).List.Clear()<br>                tbl = mScreenCriteria.LoadModifyDateList(fpUniverse.ActiveSheet.GetText(e.Row, C_UNIVERSE_ID).ToString().Trim())<br>                For Each Row As DataRow In tbl.Rows<br>                    CType(e.EditingControl, FarPoint.Win.FpCombo).List.Add(CType(Row(0), Date).ToString("MM/dd/yyyy"))<br>                Next<br>                tbl.Dispose()<br>            End If<br>        Catch ex As Exception<br>            MessageBox.Show(ex.Message)<br>        End Try<br>    End Sub<br><br>May I make mistake ? How do I fix it Scotts ? Thanks for your Help. <br>
  • Replied 8 September 2017, 12:43 pm EST

    Could you attach a small project reproducing this for us to debug?  In my small test I am not able to reproduce it.  From the looks of your code the only thing I see that could be causing this is the ListAdd method.  If that row doesn't exist you might get that exception.  You could also try removing the ToString Method.<br>
  • Replied 8 September 2017, 12:43 pm EST

    <P>In addition to what Bob asked from you, also make sure you are using the latest release of your Spread for Windows Forms version.</P>
  • Replied 8 September 2017, 12:43 pm EST

    Thanks for your help  I will check it again follow your way and response the result to you . If it is still happen I will send to you. Thanks so much. <br>
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels