Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8381537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:43:14+00:00 2026-06-09T16:43:14+00:00

for (int i = 0; i < parts.Count; i++) { if (!((part)parts[i]).deleteUsed) ((part)parts[i]).hints =

  • 0
   for (int i = 0; i < parts.Count; i++)
        {
            if (!((part)parts[i]).deleteUsed)
                ((part)parts[i]).hints = ((TextBox)partsView.Rows[i].Cells[4].FindControl("textBox")).Text;
            ((part)parts[i]).PartsWaiting = ((TextBox)partsView.Rows[i].Cells[5].FindControl("textBox1")).Text;
        }

System.NullReferenceException: Object reference not set to an instance of an object.

Im getting this error for some reason, don’t seem to figure out where I’m going wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:43:15+00:00Added an answer on June 9, 2026 at 4:43 pm

    Your problem is partly due to multiple chained deferences e.g.

    a.getB().getC().getD()
    

    and if one of those methods returns null, you can’t easily identify what’s going on.

    Unless you’re very sure of what you’re doing, I would split the above into either:

    1. separate lines and assign intermediate variables. A null will then become apparent wrt. the line that it’s on
    2. a set of functions that dereference and throw a NullPtrException upon resolving a null. Again, your offending line will become apparent immediately.

    You’ll note that the above isn’t particular to your immediate problem. Rather it’s a useful practise when you can’t be sure that chaining methods won’t return null at some stage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the object reference error in this line: emp[count].emp_id = int.Parse(parts[0]); in
int ii, maxnum; for(ii=1; ii<=num-1; ii++) { if(count[ii]>max) { // the part where I
void print(part *item, int part_count) { int i=0; for (i=0; i<part_count; i++) { printf(Item
This part of my code works fine: #include <stdio.h> int main(){ //char somestring[3] =
Booking.java This is part of my spinner code. public void onItemSelected(AdapterView<?> arg0, View v,int
@{int count = 0;} @foreach (var item in Model.Resources) { @(count <= 3 ?
As part of a fish inventory system I'm designing, I have to track where
I stuck in this part. I have declared a integer variable called count @{
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { int count = [entries count]; if (count == 0)
$sock = fsockopen($url_parts['host'], (isset($url_parts['port']) ? (int)$url_parts['port'] : 80), $errno, $errstr, 30); if (!$sock) return

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.