ByRef error though parameter is passed by ByVal
I'm getting an error while trying to fill a grid (third party). The code is as follows:
Public Sub FillTheGrid(ByRef one As String, ByRef two As String, ByRef three As String)
Dim s As String
Dim e As Short = 0
s = (one & Chr(9) & two & Chr(9) & three).ToString
e = grdUAH.AddItem(s, 0) < Error for this
grdUAH.Row = 0
grdUAH.Col = 1
grdUAH.CtlRefresh()
End Sub
Though there is no value passed a ByRef, I get the error as: Byref value type parameter cannot be null.
If I comment out the line e = grdUAH.AddItem(s, 0), there is no error!
The stack is as below:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Runtime.Remoting.RemotingException: Byref value type parameter cannot be null.
at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Type paramType)
at System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg, Object[] outArgs, Object returnValue)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at MSGrid.IGridCtrl.AddItem(String Item, Object Index)
at AxMSGrid.AxGrid.AddItem(String item, Object index)
at MFRAMEH.frmMain.FillTheGrid(String& one, String& two, String& three) in C:\ToVB.NET\MFRAMEH-socketNOTtcp\frmMain.vb:line 593
at MFRAMEH.frmMain.Timer1_Tick(Object eventSender, EventArgs eventArgs) in C:\ToVB.NET\MFRAMEH-socketNOTtcp\frmMain.vb:line 464
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr idEvent, IntPtr dwTime)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
-
MFRAMEH
Assembly Version: 1.0.2410.16790
Win32 Version: 1.0.2410.16790
CodeBase:file:///C:/ToVB.NET/MFRAMEH-socketNOTtcp/bin/MFRAMEH.exe
-
DatabaseComponents
Assembly Version: 1.0.2398.29092
Win32 Version: 1.0.2398.29092
CodeBase:file:///C:/ToVB.NET/MFRAMEH-socketNOTtcp/bin/DatabaseComponents.DLL
-
Microsoft.VisualBasic.Compatibility
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.3077
CodeBase:file:///c:/windows/assembly/gac/microsoft.visualbasic.compatibility/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.compatibility.dll
-
System.Data
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:file:///c:/windows/assembly/gac/system.data/1.0.5000.0__b77a5c561934e089/system.data.dll
-
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
-
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
-
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.3052.4
CodeBase:file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
-
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
-
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
-
System.Data.OracleClient
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:file:///c:/windows/assembly/gac/system.data.oracleclient/1.0.5000.0__b77a5c561934e089/system.data.oracleclient.dll
-
System.EnterpriseServices
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:file:///c:/windows/assembly/gac/system.enterpriseservices/1.0.5000.0__b03f5f7f11d50a3a/system.enterpriseservices.dll
-
AxInterop.Threed
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:file:///C:/ToVB.NET/MFRAMEH-socketNOTtcp/bin/AxInterop.Threed.DLL
-
AxInterop.MSGrid
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:file:///C:/ToVB.NET/MFRAMEH-socketNOTtcp/bin/AxInterop.MSGrid.DLL
-
AxSSPanelArray
Assembly Version: 1.0.2382.23438
Win32 Version: 1.0.2382.23438
CodeBase:file:///C:/ToVB.NET/MFRAMEH-socketNOTtcp/bin/AxSSPanelArray.DLL
-
Interop.Threed
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:file:///C:/ToVB.NET/MFRAMEH-socketNOTtcp/bin/Interop.Threed.DLL
-
Accessibility
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase:file:///c:/windows/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/accessibility.dll
-
Interop.MSGrid
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase:file:///C:/ToVB.NET/MFRAMEH-socketNOTtcp/bin/Interop.MSGrid.DLL
-
Interop.StdType
Assembly Version: 2.0.0.0
Win32 Version: 2.0.0.0
CodeBase:file:///C:/ToVB.NET/MFRAMEH-socketNOTtcp/bin/Interop.StdType.DLL
-
************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.
How do I solve this?

