System.NullReferenceException
-
using vb.net 2008 and latest version of JanusSystem GridEx. When I use the Try..Catch..Finally I get an error message when I am trying to get the data from the cell in a row. There can be up to 5 cells that the user has entered data into that I need to pull out if the SelectedRow is checked. If there is data in the cell I can extract it and store it to the table. If I check the next column and it is empty I get the error message below:
A first chance exception of type 'System.NullReferenceException' occurred in Janus.Windows.GridEX.v3.dll
System.NullReferenceException: Object reference not set to an instance of an object.
at Janus.Windows.GridEX.GridEXCellCollection.get_Item(GridEXColumn column)
at Janus.Windows.GridEX.GridEX.GetValue(GridEXColumn column)
at Janus.Windows.GridEX.GridEX.GetValue(String columnKey)
at JWI.frmLOL.SaveTab1(Object& _frmGuid) in C:\JWI\JWI\JWI\frmLOL.vb:line 708If I use the old VB6 On Error Resume Next then I don't even pick up the data that is in the cells, the code just goes right over the lines:
strJnts = GridEX1.GetValue("E") 'or "B1" or "B2" etc
And I never hit the DoSaveData function. Not sure what the solution is or even the problem. I've tried at least a dozen diferrent codings for IsNotDBNull and anything I could find in the MSDN and online but nothing seems to help. I have a message into the JanusSystem forum but they won't be answering until mid morning Monday and I would like a solution later tonight or Sunday if possible. The entire function code follows:
Public Function SaveTab1(ByRef \_frmGuid As Object) As Boolean Dim rowNdx As Integer = 0 'Set to zero index value Dim strJnts As String Dim \_MATGuid As Object Try 'On Error Resume Next GridEX1.BoundMode = Janus.Windows.GridEX.BoundMode.Unbound 'allows us to use it in AddItem mode GridEX1.KeepRowSettings = True 'keeps settings same when row scrolls out of sight Dim checkedRows() As Janus.Windows.GridEX.GridEXRow checkedRows = GridEX1.GetCheckedRows() 'if the user didn't check any row, you will get an empty array If checkedRows.Length = 0 Then 'no materials on Tab1 Tubing so we need to check Tab2 Pipe 'SaveTab2() Else Dim row As Janus.Windows.GridEX.GridEXRow For Each row In checkedRows 'get th
-
using vb.net 2008 and latest version of JanusSystem GridEx. When I use the Try..Catch..Finally I get an error message when I am trying to get the data from the cell in a row. There can be up to 5 cells that the user has entered data into that I need to pull out if the SelectedRow is checked. If there is data in the cell I can extract it and store it to the table. If I check the next column and it is empty I get the error message below:
A first chance exception of type 'System.NullReferenceException' occurred in Janus.Windows.GridEX.v3.dll
System.NullReferenceException: Object reference not set to an instance of an object.
at Janus.Windows.GridEX.GridEXCellCollection.get_Item(GridEXColumn column)
at Janus.Windows.GridEX.GridEX.GetValue(GridEXColumn column)
at Janus.Windows.GridEX.GridEX.GetValue(String columnKey)
at JWI.frmLOL.SaveTab1(Object& _frmGuid) in C:\JWI\JWI\JWI\frmLOL.vb:line 708If I use the old VB6 On Error Resume Next then I don't even pick up the data that is in the cells, the code just goes right over the lines:
strJnts = GridEX1.GetValue("E") 'or "B1" or "B2" etc
And I never hit the DoSaveData function. Not sure what the solution is or even the problem. I've tried at least a dozen diferrent codings for IsNotDBNull and anything I could find in the MSDN and online but nothing seems to help. I have a message into the JanusSystem forum but they won't be answering until mid morning Monday and I would like a solution later tonight or Sunday if possible. The entire function code follows:
Public Function SaveTab1(ByRef \_frmGuid As Object) As Boolean Dim rowNdx As Integer = 0 'Set to zero index value Dim strJnts As String Dim \_MATGuid As Object Try 'On Error Resume Next GridEX1.BoundMode = Janus.Windows.GridEX.BoundMode.Unbound 'allows us to use it in AddItem mode GridEX1.KeepRowSettings = True 'keeps settings same when row scrolls out of sight Dim checkedRows() As Janus.Windows.GridEX.GridEXRow checkedRows = GridEX1.GetCheckedRows() 'if the user didn't check any row, you will get an empty array If checkedRows.Length = 0 Then 'no materials on Tab1 Tubing so we need to check Tab2 Pipe 'SaveTab2() Else Dim row As Janus.Windows.GridEX.GridEXRow For Each row In checkedRows 'get th
Your best source of information is going to be Janus' support forums. From the tack trace, it looks like you may have found a problem with their control.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
Your best source of information is going to be Janus' support forums. From the tack trace, it looks like you may have found a problem with their control.
A guide to posting questions on CodeProject[^]
Dave KreskowiakBummer, I have used the grid extensively to fill up with data and have the user group and sort the information. Love it for that, but this is first time trying to take a virtually empty grid and grab just the selected data from it. I've tried setting the value to <> Empty, Nothing, DBNull and many other things. Their sampls show them using a grid similarly for an odering application so I'm trying now to follow the code to see if I can locate how they check for a null value in a selected row cell. I'm also looking at how the settings for the myriad of properties may be different than the default. If any ideas pop up please let me know, Larry