473,320 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to fix a Object Reference Error?

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:

MetaDataResponseSet is an array type and is what is required by the AgentResponseToDTO() 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 886

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

Similar topics

0
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...
1
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...
2
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...
9
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...
7
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...
2
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...
1
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...
2
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...
1
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...
1
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...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.