473,799 Members | 3,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to fix a Object Reference Error?

68 New Member
Hi

The method below fails on the line marked in bold and I receive an object reference error. I know that this is a common error but, I've tried changing several assignments to ensure they match up with the required types and it the method still fails.

I also tried:

Expand|Select|Wrap|Line Numbers
  1. agentResponse(0).InputData = testMetaDataArray
without the () after .InputData, but that still fails as well.

Just for extra information:

MetaDataRespons eSet is an array type and is what is required by the AgentResponseTo DTO() method.

MetaDataGroup is also an array type which has various properties, the only two I need to assign to are .Name and .Size

Expand|Select|Wrap|Line Numbers
  1. Public Sub TestAgentResponseToDTOResponseFieldSize2()
  2.  
  3.         Dim agentResponse(0) As MetaDataResponseSet
  4.  
  5.         ''Create a MetaDataGroup object that can store 2 items
  6.         Dim testMetaDataArray(1) As MetaDataGroup
  7.  
  8.         Dim mdaObject1 As MetaDataGroup = New MetaDataGroup()
  9.         mdaObject1.Name = "my name"
  10.         mdaObject1.Size = 3
  11.  
  12.         Dim mdaObject2 As MetaDataGroup = New MetaDataGroup()
  13.         mdaObject2.Name = "is Mathieu"
  14.         mdaObject2.Size = 6
  15.  
  16.         testMetaDataArray(0) = mdaObject1
  17.         testMetaDataArray(1) = mdaObject2
  18.  
  19.         'testMetaDataArray(0).Name = "my name"
  20.         'testMetaDataArray(0).Size = 3
  21.  
  22.  
  23.         agentResponse(0).InputData() = testMetaDataArray '' fails here
  24.  
  25.         '' Create a result object
  26.         Dim result As Boolean = True
  27.  
  28.         Dim assemblerResponse = ExperianBankValMetaDataCallAssembler.AgentResponseToDTO(agentResponse)
  29.  
  30.         Assert.AreEqual(agentResponse(0).InputData(0).Size, assemblerResponse.InputFields(0).Length)
  31.         Assert.AreEqual(agentResponse(0).InputData(0).Name, assemblerResponse.InputFields(0).Name)
  32.  
  33.         Assert.AreEqual(agentResponse(0).InputData(1).Size, assemblerResponse.InputFields(1).Length)
  34.         Assert.AreEqual(agentResponse(0).InputData(1).Name, assemblerResponse.InputFields(1).Name)
  35.  
  36.         Assert.AreEqual(result, assemblerResponse.Result.Success)
  37.  
  38.     End Sub
I hope that you can clearly understand this method without me having to show the related class code.

Can anyone see where I've gone wrong?

Thank, Matt
Jan 27 '11 #1
0 899

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1731
by: VBProgrammer | last post by:
I get the following error when I do an Excel.Workbooks.Open. This error occurs on some PCs but not others. The error and associated code are below. Thanks in advanc Error System.NullReferenceException: Object reference not set to an instance of an object at Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin,...
1
3025
by: Martine | last post by:
Hi there! I have a problem with programmatically adding user controls to my mobile webforms. If I load my usercontrol programmatically (in the Page_Load), the object is instantiated, I have access to the methods and properties from the Page_Load, no problem there. But as soon as I want access to the user control from another procedure on the same page, I get the next error message: "Object reference not set to an instance of an...
2
2219
by: Jeff | last post by:
I'm getting an Object Reference error before I even run my app, and I'm not sure where to look to find the cause. I'd appreciate your help. When I open my Windows Application project, the following Microsoft Development Environment error message displays: "Object reference not set to an instance of an object." Then when I access the design view of one of my forms, the controls on
9
1651
by: Remulac | last post by:
Hello, I'm trying to get the value out of a dropdown list box and assign it to a variable. When I click on the list box, I invoke this line of code. I get the error, "Object reference not set to an instance of an object". The same list box is referenced successfully in the form load. Does anyone know what might cause this problem?
7
1572
by: Brett | last post by:
I'm not sure why I keep getting this error, "Object reference not set to an instance of an object". Private Function somefunction() as string Dim MyCurrentClass As New Class1 Try For i As Integer = 0 To LinkResults.Length - 1 With MyCurrentClass.SqlCmd_Insert_LinkVB .CommandType = System.Data.CommandType.StoredProcedure
2
1323
by: tjonsek | last post by:
I've been reading most of the day on how to use datagrids and came up with code to delete a record. I'm getting an error "Object Reference not set to an instance of an object" for the line where I set the command's connection. I really am confused as this same basic code works throughout my project. I thought perhaps because the event is bubbling up from the datagrid? Here's my code. Any insight would help. Thanks. (cnnGIS has been...
1
1147
by: craig.melbourne | last post by:
I'm getting a strange bug with my of my applications When I build and run the app on my develpment machine all works fine. Once I move it to another machine I get a typical Object Reference error reported to the Even Viewer. Any thoughts appreciated.
2
1942
by: danielle.m.manning | last post by:
I have a question about a problem I am having with attempting to port some old ASP code to ASP.NET. We have a dll out there which we downloaded which creates GUIDs for session management. In ASP, the function looks like this: Function getGuid() Dim sessionDUID Dim MyGuid = Server.CreateObject("GuidMakr.GUID") Dim mySession = Replace(MyGuid.GetGUID, "{", "")
1
4220
by: Nathan Sokalski | last post by:
I have a UserControl that I declare programmatically as follows: Dim userctrl as New rightside_portal() The codebehind file for this UserControl looks like the following: Partial Public Class rightside_portal : Inherits System.Web.UI.UserControl Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
1
4403
by: prithvis.mohanty | last post by:
using System; using System.Drawing; using System.ComponentModel; using System.Windows.Forms; using System.Runtime.InteropServices; using System.Text; using System.Collections; using System.Diagnostics; public delegate bool IECallBack(int hwnd, int lParam);
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9546
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10243
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9078
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.