Error in ComboboxCellType

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

  • Posted 8 September 2017, 12:43 pm EST

    Hi Scotts.

    I got this error in my project :

    System.NullReferenceException was unhandled
      Message="Object reference not set to an instance of an object."
      Source="FarPoint.Win.Spread"
      StackTrace:
           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.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(ApplicationContext context)
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
           at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
           at EquityResearch.Net.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
           at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()

    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.

    This is code which I wrote in event  ComboDropDown:
        Private Sub fpUniverse_ComboDropDown(ByVal sender As System.Object, ByVal e As FarPoint.Win.Spread.EditorNotifyEventArgs) Handles fpUniverse.ComboDropDown
            Dim tbl As New DataTable
            Try
                If e.Column = C_UNIVERSE_DATE Then
                    CType(e.EditingControl, FarPoint.Win.FpCombo).AcceptsReturn = True
                    CType(e.EditingControl, FarPoint.Win.FpCombo).List.Clear()
                    tbl = mScreenCriteria.LoadModifyDateList(fpUniverse.ActiveSheet.GetText(e.Row, C_UNIVERSE_ID).ToString().Trim())
                    For Each Row As DataRow In tbl.Rows
                        CType(e.EditingControl, FarPoint.Win.FpCombo).List.Add(CType(Row(0), Date).ToString("MM/dd/yyyy"))
                    Next
                    tbl.Dispose()
                End If
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End Sub

    May I make mistake ? How do I fix it Scotts ? Thanks for your Help.
  • 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.
  • Replied 8 September 2017, 12:43 pm EST

    Hello,


    In addition to what Bob asked from you, also make sure you are using the latest release of your Spread for Windows Forms version.

  • 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.
Need extra support?

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

Learn More

Forum Channels